mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: add os.quoted_path/1, use it consistently for running V itself
This commit is contained in:
@@ -7,7 +7,7 @@ const simple_flag_app_executable = os.real_path(os.join_path(os.cache_dir(), 'si
|
||||
fn testsuite_begin() {
|
||||
os.chdir(@VMODROOT) or {}
|
||||
os.rm(simple_flag_app_executable) or {}
|
||||
res := os.execute('${@VEXE} -o $simple_flag_app_executable $source')
|
||||
res := os.execute('${os.quoted_path(@VEXE)} -o ${os.quoted_path(simple_flag_app_executable)} ${os.quoted_path(source)}')
|
||||
assert res.exit_code == 0
|
||||
assert os.execute(simple_flag_app_executable).exit_code == 0
|
||||
}
|
||||
@@ -19,7 +19,7 @@ fn testsuite_end() {
|
||||
|
||||
fn check_program(opts string, extension string) {
|
||||
result := source.replace('.v', extension)
|
||||
res := os.execute('$simple_flag_app_executable $opts')
|
||||
res := os.execute('${os.quoted_path(simple_flag_app_executable)} $opts')
|
||||
lines := os.read_lines(result) or { panic(err) }
|
||||
assert res.exit_code == 0
|
||||
assert res.output.split_into_lines() == lines
|
||||
|
||||
@@ -7,9 +7,9 @@ const the_executable = os.real_path(os.join_path(os.cache_dir(), 'flag_usage_exa
|
||||
fn testsuite_begin() {
|
||||
os.chdir(@VMODROOT) or {}
|
||||
os.rm(the_executable) or {}
|
||||
res := os.execute('${@VEXE} -o $the_executable $the_source')
|
||||
res := os.execute('${os.quoted_path(@VEXE)} -o ${os.quoted_path(the_executable)} ${os.quoted_path(the_source)}')
|
||||
assert res.exit_code == 0
|
||||
assert os.execute(the_executable).exit_code == 0
|
||||
assert os.execute(os.quoted_path(the_executable)).exit_code == 0
|
||||
C.atexit(fn () {
|
||||
os.rm(the_executable) or {}
|
||||
})
|
||||
@@ -21,7 +21,7 @@ fn normalise_lines(lines []string) string {
|
||||
|
||||
fn check_program(opts string, extension string) {
|
||||
result := the_source.replace('.v', extension)
|
||||
res := os.execute('$the_executable $opts')
|
||||
res := os.execute('${os.quoted_path(the_executable)} $opts')
|
||||
assert res.exit_code == 0
|
||||
assert normalise_lines(res.output.split_into_lines()) == normalise_lines(os.read_lines(result) or {
|
||||
panic(err)
|
||||
|
||||
Reference in New Issue
Block a user