Skip to content

Commit 432da69

Browse files
committed
ci: stabilize macOS password input test
1 parent 50aec3b commit 432da69

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

examples/password/password_test.v

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ const expect_exe = os.find_abs_path_of_executable('expect') or {
99
const expect_tests_path = os.join_path(@VMODROOT, 'examples', 'password', 'tests')
1010

1111
fn test_password_input() {
12-
correct := os.execute(os.join_path(expect_tests_path, 'correct.expect'))
12+
correct :=
13+
os.execute('${os.quoted_path(os.join_path(expect_tests_path, 'correct.expect'))} ${os.quoted_path(@VEXE)}')
1314
assert correct.exit_code == 0, correct.output
1415

15-
incorrect := os.execute(os.join_path(expect_tests_path, 'incorrect.expect'))
16+
incorrect :=
17+
os.execute('${os.quoted_path(os.join_path(expect_tests_path, 'incorrect.expect'))} ${os.quoted_path(@VEXE)}')
1618
assert incorrect.exit_code == 0, incorrect.output
1719

1820
expected_out := 'Enter your password : '
19-
mut res :=
20-
os.execute('${os.join_path(expect_tests_path, 'output_from_expect_arg.expect')} "${expected_out}"')
21+
mut res := os.execute('${os.quoted_path(os.join_path(expect_tests_path,
22+
'output_from_expect_arg.expect'))} ${os.quoted_path(@VEXE)} ${os.quoted_path(expected_out)}')
2123
assert res.exit_code == 0, res.output
2224

2325
not_exptectd_out := 'Enter your passwords : '
24-
res =
25-
os.execute('${os.join_path(expect_tests_path, 'output_from_expect_arg.expect')} "${not_exptectd_out}"')
26+
res = os.execute('${os.quoted_path(os.join_path(expect_tests_path,
27+
'output_from_expect_arg.expect'))} ${os.quoted_path(@VEXE)} ${os.quoted_path(not_exptectd_out)}')
2628
assert res.exit_code == 1, res.output
2729
}

examples/password/tests/correct.expect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
set timeout 3
44
set v_root [exec sh -c "git rev-parse --show-toplevel"]
5+
set v_exe [lindex $argv 0]
56

6-
spawn $v_root/v run $v_root/examples/password/password.v
7+
spawn $v_exe -old-compiler run $v_root/examples/password/password.v
78

89
expect "Enter your password : " { send "Sample\r" } timeout { exit 1 }
910
expect "Confirm password : " { send "Sample\r" } timeout { exit 1 }

examples/password/tests/incorrect.expect

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
set timeout 3
44
set v_root [exec sh -c "git rev-parse --show-toplevel"]
5+
set v_exe [lindex $argv 0]
56

6-
spawn $v_root/v run $v_root/examples/password/password.v
7+
spawn $v_exe -old-compiler run $v_root/examples/password/password.v
78

89
expect "Enter your password : " { send "Sample123\r" } timeout { exit 1 }
910
expect "Confirm password : " { send "Sample234\r" } timeout { exit 1 }

examples/password/tests/output_from_expect_arg.expect

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
set timeout 3
44
set v_root [exec sh -c "git rev-parse --show-toplevel"]
5+
set v_exe [lindex $argv 0]
56
# Send expected output as arg to re-use the script for testing incorrect values.
6-
set expect_ [lindex $argv 0]
7+
set expect_ [lindex $argv 1]
78

8-
spawn $v_root/v run $v_root/examples/password/password.v
9+
spawn $v_exe -old-compiler run $v_root/examples/password/password.v
910

1011
expect $expect_ {} timeout { exit 1 }
1112

0 commit comments

Comments
 (0)