mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
ed06618498
commit
f4b110b1a4
@ -811,6 +811,7 @@ fn (mut p Parser) other_stmts(cur_stmt ast.Stmt) ast.Stmt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p.open_scope()
|
p.open_scope()
|
||||||
|
p.cur_fn_name = 'main.main'
|
||||||
mut stmts := []ast.Stmt{}
|
mut stmts := []ast.Stmt{}
|
||||||
if cur_stmt != ast.empty_stmt {
|
if cur_stmt != ast.empty_stmt {
|
||||||
stmts << cur_stmt
|
stmts << cur_stmt
|
||||||
|
3
vlib/v/tests/repl/comptime_tmpl.repl
Normal file
3
vlib/v/tests/repl/comptime_tmpl.repl
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
$tmpl('./tmpl/hello.txt')
|
||||||
|
===output===
|
||||||
|
hello
|
@ -49,6 +49,9 @@ pub fn run_repl_file(wd string, vexec string, file string) !string {
|
|||||||
input_temporary_filename := os.real_path(os.join_path(wd, 'input_temporary_filename.txt'))
|
input_temporary_filename := os.real_path(os.join_path(wd, 'input_temporary_filename.txt'))
|
||||||
os.write_file(input_temporary_filename, input) or { panic(err) }
|
os.write_file(input_temporary_filename, input) or { panic(err) }
|
||||||
os.write_file(os.real_path(os.join_path(wd, 'original.txt')), fcontent) or { panic(err) }
|
os.write_file(os.real_path(os.join_path(wd, 'original.txt')), fcontent) or { panic(err) }
|
||||||
|
os.cp_all('vlib/v/tests/repl/tmpl', os.real_path(os.join_path(wd, 'tmpl')), true) or {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
rcmd := '${os.quoted_path(vexec)} repl -replfolder ${os.quoted_path(wd)} -replprefix "${fname}." < ${os.quoted_path(input_temporary_filename)}'
|
rcmd := '${os.quoted_path(vexec)} repl -replfolder ${os.quoted_path(wd)} -replprefix "${fname}." < ${os.quoted_path(input_temporary_filename)}'
|
||||||
r := os.execute(rcmd)
|
r := os.execute(rcmd)
|
||||||
if r.exit_code != 0 {
|
if r.exit_code != 0 {
|
||||||
|
1
vlib/v/tests/repl/tmpl/hello.txt
Normal file
1
vlib/v/tests/repl/tmpl/hello.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
hello
|
Loading…
x
Reference in New Issue
Block a user