def deactivate_spec() -> Do: yield await_k(flag_channel_id_becomes, not_equal(-1)) channel = yield flag_channel_id() yield await_k(flag_jobpid_becomes, greater(0)) yield nvim_command('CrmDeactivate') command_nonexistent = yield await_k(command_must_not_exist, 'FlagTest', timeout=10) quit_var = yield var_must_become('flagellum_quit', 1) pid = yield N.safe(nvim_call_tpe(int, 'jobpid', channel)) return ( command_nonexistent & k(pid).must(have_type(NError)) & quit_var )
def bootstrap_spec() -> Do: yield variable_set_prefixed('interpreter', 'python3.7') yield variable_set_prefixed('autobootstrap', False) yield option_cat('runtimepath', List(str(project))) cram_exists_not = yield await_k(command_must_not_exist, 'Cram') yield runtime('chromatin.nvim/plugin/bootstrap') yield command_once_defined('BootstrapChromatin', timeout=3) yield command_once_defined('CrmSetupPlugins', timeout=30) plugin_exists = yield plug_exists('Flag', timeout=20) return cram_exists_not & plugin_exists
def reboot_spec() -> Do: before = yield call_once_defined(reboot_test) json = yield N.e(dump_json(update_query)) yield nvim_command(f'CrmUpdateState {json}') yield seen_program('update_state') updated_path = yield await_k(check_path) yield nvim_command('CrmUpdate') yield nvim_command('CrmReboot') yield wait_for_function_undef(reboot_test) after = yield call_once_defined(reboot_test) return updated_path & (k(before) == 13) & (k(after) == 17)
def twice_spec() -> Do: yield nvim_sync_command('CrmActivate') yield await_k(log_entry, resources.already_active(List(name)))
def update_spec() -> Do: yield nvim_sync_command('CrmUpdate') yield await_k(log_entry, resources.updated_plugin(name), timeout=10)
def config_spec() -> Do: yield nvim_command('FlagConfTest') x1 = yield var_must_become('flagellum_value', 'success') x2 = yield await_k(log_entry, 'success') return x1 & x2
def autocmd_spec() -> Do: yield doautocmd('VimEnter') yield await_k(log_entry, 'autocmd works')
def cmd_parameter_spec() -> Do: yield nvim_command('FlagArgTest', 1) yield await_k(log_entry, 'success 1')
def proteome(self) -> Expectation: return cached_venvs_test(List('proteome'), lambda: await_k(command_must_exist, 'ProAdd'))
def stages_spec() -> Do: entries = yield names.traverse( lambda a: await_k(log_entry, f'{a} initialized'), NvimIO) fvar = yield var_must_become('flag', 2) cvar = yield var_must_become('cil', 1) return entries.fold(AlgExpectation) & fvar & cvar
def flag_cil_spec(spec: Callable[[], NvimIO[Expectation]]) -> Do: yield wait_for_command('FlagTest') yield wait_for_command('CilTest') yield await_k(log_entry, 'cilia initialized') yield spec()
def plug_exists(name: str, timeout=5, **kw: Any) -> NvimIO[Expectation]: cmd = f'{name}Test' return await_k(command_must_exist, cmd, timeout=timeout, **kw)
def dir_venv_spec() -> Do: flag_dir = fixture_path('rplugin', 'flagellum') yield NS.lift(variable_set_prefixed('autostart', True)) yield request('cram', f'dir:{flag_dir}', name='flagellum') yield NS.lift(wait_for_command('FlagTest', timeout=1)) yield NS.lift(await_k(log_entry, 'flagellum initialized'))