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 install_one(name: str, venv_dir: Maybe[Path]=Nothing) -> Do: base_dir, plugin = yield setup_one_with_venvs(name, venv_dir) yield nvim_command('CrmSetupPlugins') yield venv_existent(base_dir)(plugin) package_installed(base_dir, plugin) venv = yield plugin_venv(base_dir, plugin) return base_dir, venv, plugin
def rplugin_stage(prefix: str, num: int) -> Do: name = f'{prefix}Stage{num}' exists = yield command_exists(name) if exists: yield nvim_command(name) else: fun_exists = yield function_exists(name) if fun_exists: yield nvim_call_function(name)
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 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 cmd_parameter_spec() -> Do: yield nvim_command('FlagArgTest', 1) yield await_k(log_entry, 'success 1')
def stop_rplugin(name: str, channel: int, triggers: List[RpcTrigger]) -> Do: yield nvim_command(f'{camelcase(name)}Quit') yield triggers.traverse(undef_trigger, NvimIO) yield nvim_command('autocmd!', name) yield stop_host(channel)
def undef_trigger(trigger: RpcTrigger) -> Do: method = undef_command.match(trigger.method) yield method.map(lambda a: nvim_command(a, trigger.name)).get_or_strict( N.unit)