cmd_doctor_test.v

752 B · raw

1module cli23import os4import src.history5import src.snapshot6import src.storage78fn test_doctor_reports_unsafe_save_paths_with_a_quoted_strip_command() {9	dir := os.join_path(os.temp_dir(), 'koh3_doctor_paths_${os.getpid()}')10	os.rmdir_all(dir) or {}11	os.mkdir_all(dir)!12	defer {13		os.rmdir_all(dir) or {}14	}15	store := storage.create(dir)!16	defer {17		store.close()18	}19	hash := store.put_object('unsafe'.bytes())!20	store.begin()!21	history.import_save(store, history.Save{22		id: 'badbadbadbad'23	}, [snapshot.FileEntry{24		path: "../June's file"25		hash: hash26	}])!27	history.set_head(store, 'badbadbadbad')!28	store.end()!29	assert unsafe_save_paths(store)! == [30		"save [badbadbadbad] has unsafe path ../June's file — koh strip '../June'\\''s file'",31	]32}