atexit(vim_mem_profile_dump);
#endif
+ /*
+ * Various initialisations #1 shared with tests.
+ */
+ common_init_1();
+
#if defined(STARTUPTIME) || defined(FEAT_JOB_CHANNEL)
// Need to find "--startuptime" and "--log" before actually parsing
// arguments.
#endif
/*
- * Various initialisations shared with tests.
+ * Various initialisations #2 shared with tests.
*/
- common_init(¶ms);
+ common_init_2(¶ms);
#ifdef VIMDLL
// Check if the current executable file is for the GUI subsystem.
}
/*
- * Initialisation shared by main() and some tests.
+ * Initialisation #1 shared by main() and some tests.
*/
void
-common_init(mparm_T *paramp)
+common_init_1(void)
{
estack_init();
cmdline_init();
|| (NameBuff = alloc(MAXPATHL)) == NULL)
mch_exit(0);
TIME_MSG("Allocated generic buffers");
+}
+
+/*
+ * Initialisation #2 shared by main() and some tests.
+ */
+ void
+common_init_2(mparm_T *paramp)
+{
#ifdef NBDEBUG
// Wait a moment for debugging NetBeans. Must be after allocating
// NameBuff.
CLEAR_FIELD(params);
params.argc = argc;
params.argv = argv;
- common_init(¶ms);
+ common_init_1();
+ common_init_2(¶ms);
set_option_value_give_err((char_u *)"encoding", 0, (char_u *)"utf-8", 0);
init_chartab();
/* main.c */
int vim_main2(void);
-void common_init(mparm_T *paramp);
+void common_init_1(void);
+void common_init_2(mparm_T *paramp);
int is_not_a_term(void);
int is_not_a_term_or_gui(void);
void free_vbuf(void);
call delete('Xlogfile')
endfunc
+func Test_log_nonexistent()
+ " this used to crash Vim
+ CheckFeature channel
+ let result = join(systemlist(GetVimCommand() .. ' --log /X/Xlogfile -c qa!'))
+ call assert_match("E484: Can't open file", result)
+endfunc
+
func Test_read_stdin()
let after =<< trim [CODE]
write Xtestout