@@ -40,24 +40,31 @@ fn cleanup_tdir() {
40
40
os.rmdir_all (tdir) or { eprintln (err) }
41
41
}
42
42
43
+ fn create_test (tname string , tcontent string ) ? string {
44
+ tpath := os.join_path (tdir, tname)
45
+ os.write_file (tpath, tcontent) ?
46
+ eprintln ('>>>>>>>> tpath: $tpath | tcontent: $tcontent ' )
47
+ return tpath
48
+ }
49
+
43
50
fn main () {
44
51
defer {
45
52
os.chdir (os.wd_at_startup) or {}
46
53
}
47
54
println ('> vroot: $vroot | vexe: $vexe | tdir: $tdir ' )
48
- ok_fpath := os.join_path (tdir, 'single_test.v' )
49
- os.write_file (ok_fpath, 'fn test_ok(){ assert true }' ) ?
50
- check_ok ('"$vexe " $ok_fpath ' )
51
- check_ok ('"$vexe " test $ok_fpath ' )
52
- fail_fpath := os.join_path (tdir, 'failing_test.v' )
53
- os.write_file (fail_fpath, 'fn test_fail(){ assert 1 == 2 }' ) ?
54
- check_fail ('"$vexe " $fail_fpath ' )
55
- check_fail ('"$vexe " test $fail_fpath ' )
56
- check_fail ('"$vexe " test $tdir ' )
55
+ ok_fpath := create_test ('a_single_ok_test.v' , 'fn test_ok(){ assert true }' ) ?
56
+ check_ok ('"$vexe " "$ok_fpath "' )
57
+ check_ok ('"$vexe " test "$ok_fpath "' )
58
+ check_ok ('"$vexe " test "$tdir "' )
59
+ fail_fpath := create_test ('a_single_failing_test.v' , 'fn test_fail(){ assert 1 == 2 }' ) ?
60
+ check_fail ('"$vexe " "$fail_fpath "' )
61
+ check_fail ('"$vexe " test "$fail_fpath "' )
62
+ check_fail ('"$vexe " test "$tdir "' )
57
63
rel_dir := os.join_path (tdir, rand.ulid ())
58
64
os.mkdir (rel_dir) ?
59
65
os.chdir (rel_dir) ?
60
- check_ok ('"$vexe " test ..${os.path_separator + os.base(ok_fpath)} ' )
66
+ check_ok ('"$vexe " test "..${os.path_separator + os.base(ok_fpath)} "' )
67
+ println ('> all done' )
61
68
}
62
69
63
70
fn check_ok (cmd string ) string {
0 commit comments