Ejemplo n.º 1
0
 def browse(self):
     ''' Browse the history of a single file
     adds one commit that doesn't contain changes in test_file_1.
     there are four commits in summary, so the check for buffer line
     count compares with 3.
     at the end, a fifth commit must be present due to resetting the
     file contents.
     '''
     check = self._check
     marker_text = Random.string()
     self.vim.buffer.set_content([marker_text])
     self._save()
     self._write_file(1)
     self._save()
     self._write_file2(1)
     self._save()
     self._write_file(2)
     self._write_file2(1)
     self._save()
     self.vim.cmd('ProHistoryFileBrowse {}'.format('test_file_1'))
     check(0, '*')
     self.vim.vim.feedkeys('j')
     self.vim.vim.feedkeys('j')
     later(lambda: self.vim.buffer.content.length.should.equal(3))
     self.vim.vim.feedkeys('s')
     self._await_commit(0)
     self.vim.buffer.content.should.equal(List(marker_text))
     self.repo.history.drain.should.have.length_of(5)
Ejemplo n.º 2
0
 def clean_workdir(self):
     self._save()
     self._write_file(1)
     self._save()
     self.vim.cmd('ProSave')
     self.vim.cmd('ProHistoryLog')
     later(lambda: self._log_out.should.have.length_of(2))
Ejemplo n.º 3
0
 def select_add(self, unite):
     self._mk_projects()
     self.vim.cmd('ProSelectAdd')
     lines = List(
         ' {}'.format(self.name1),
         ' {}'.format(self.other2),
     )
     later(lambda: self.vim.buffer.content.should.equal(lines))
Ejemplo n.º 4
0
 def command(self):
     plug = 'unit._support.test_plug'
     prot = DictProteome(self.vim, null, List(plug), List(), Map())
     prot.start_wait()
     data = 'message_data'
     prot.plug_command('test_plug', 'do', [data])
     later(lambda: prot.data.should.have.key(data).being.equal(data))
     prot.stop()
Ejemplo n.º 5
0
 def ctags(self):
     asyncio.get_child_watcher()
     self.proteome.proteome_start()
     self.pros.foreach(lambda a: self.proteome.pro_add([a.ident]))
     self._await()
     self.proteome.pro_save()
     self._await()
     later(lambda: self.pros.foreach(lambda a: a.tag_file.should.exist))
Ejemplo n.º 6
0
 def remove_by_ident(self):
     self.proteome.proteome_start()
     self.proteome.proteome_post_startup()
     self._await()
     self.proteome.pro_add(['python/pro2'])
     later(lambda: self._env.current_index.should.equal(1))
     self.proteome.pro_remove(['python/pro2'])
     later(lambda: self._env.current_index.should.equal(0))
Ejemplo n.º 7
0
 def activate(self, unite):
     def active_type(tpe):
         self.vim.vars.p('active').map(_['tpe']).should.contain(tpe)
     self.vim.cmd('ProAdd tpe2/dep')
     later(F(active_type, self.tpe2))
     self.vim.cmd('Projects')
     self._wait(0.1)
     self.vim.cmd('call feedkeys("\\<tab>\\<esc>\\<cr>")')
     later(F(active_type, self.tpe1))
Ejemplo n.º 8
0
 def init(self):
     def check_head(p):
         (self.history_base / p.fqn / 'HEAD').exists().should.be.ok
     p1 = self.main_project
     p2 = self.mk_project('pro2', 'go')
     pros = List(p1, p2)
     with self._prot(List(self.plug_name), pros=pros) as prot:
         prot.plug_command('history', 'StageIV', List())
         later(lambda: check_head(p1))
         check_head(p2)
Ejemplo n.º 9
0
 def select_add_all(self, unite):
     self._mk_projects()
     self.vim.cmd('ProSelectAddAll -auto-resize')
     lines = List(
         ' {}/{}'.format(self.tpe1, self.name1),
         ' {}/{}'.format(self.tpe2, self.name2),
         ' {}/{}'.format(self.tpe1, self.other2),
         ' {}/{}'.format(self.typed1, self.other),
         ' {}'.format(self.name1),
         ' {}'.format(self.other2),
     )
     later(lambda: self.vim.buffer.content.should.equal(lines))
Ejemplo n.º 10
0
 def quit(self):
     check = self._check
     marker_text = Random.string()
     self.vim.buffer.set_content([marker_text])
     self._save()
     self._write_file(1)
     self._save()
     self._write_file(2)
     self._save()
     self.vim.cmd('ProHistoryBrowse')
     check(0, '*')
     self.vim.feedkeys('q')
     later(lambda: self.vim.buffer.content.should.equal(List(marker_text)))
Ejemplo n.º 11
0
 def prev_next(self):
     p1 = self.main_project
     p2 = self.mk_project('pro2', 'go')
     pros = List(p1, p2)
     with self._prot(List(self.plug_name), pros=pros) as prot:
         with test_loop() as loop:
             prot.plug_command('history', 'StageIV', List())
             self._three_commits(prot, loop)
             prot.plug_command('history', 'HistoryLog', List())
             prot.plug_command('history', 'HistoryPrev', List())
             prot.plug_command('history', 'HistoryLog', List())
             later(lambda: self.test_file_1.read_text()
                   .should.equal(self.test_content[1]))
             prot.plug_command('history', 'HistoryNext', List())
             later(lambda: self.test_file_1.read_text()
                   .should.equal(self.test_content[2]))
Ejemplo n.º 12
0
 def ctags(self):
     plug_name = 'proteome.plugins.ctags'
     p1 = self.mk_project('pro1', 'c')
     p2 = self.mk_project('pro2', 'go')
     pros = List(p1, p2)
     with self._prot(List(plug_name), pros=pros) as prot:
         with test_loop() as loop:
             plug = prot.plugin('ctags')._get
             p1.tag_file.exists().should_not.be.ok
             p2.tag_file.exists().should_not.be.ok
             prot.plug_command('ctags', 'gen_all', List())
             def check(p):
                 plug.ctags.await_threadsafe(loop)
                 p.tag_file.exists().should.be.ok
             later(lambda: check(p1))
             later(lambda: check(p2))
             plug.ctags.ready.should.be.ok
Ejemplo n.º 13
0
 def add_buffer(self):
     tags = lambda: self.vim.buffer.options.l('tags')
     later(lambda: tags().should.contain(str(self.tag_file)))
     self.vim.cmd('ProAdd tpe2/dep')
     later(lambda: tags().should.have.length_of(2))
     self.vim.cmd('new')
     later(lambda: tags().should.have.length_of(2))
Ejemplo n.º 14
0
 def _count(self, num):
     return later(
         lambda: (self.vim.vars.p('projects') / len).should.contain(num))
Ejemplo n.º 15
0
 def _check(self, index, start):
     def checker():
         buf = self.vim.buffer.target
         len(buf).should.be.greater_than(max(3, index + 1))
         buf[index].startswith(start).should.be.ok
     later(checker)
Ejemplo n.º 16
0
 def _await_content(self, text):
     def checker():
         self.test_file_1.read_text()\
             .should.equal(text)
     later(checker)
Ejemplo n.º 17
0
 def valid(self):
     name = 'proteome.nvim'
     self.vim.cmd('ProClone tek/{}'.format(name))
     readme = self.base / self.tpe1 / name / 'README.md'
     later(lambda: readme.exists().should.be.ok)
     self._pvar_becomes_map('active', name, _['name'])