diff --git a/cmd/tools/vrepl.v b/cmd/tools/vrepl.v index 699570994b6bab..8add38f1861c93 100644 --- a/cmd/tools/vrepl.v +++ b/cmd/tools/vrepl.v @@ -435,6 +435,8 @@ fn run_repl(workdir string, vrepl_prefix string) int { if s.output.len > r.last_output.len { cur_line_output := s.output[r.last_output.len..] print_output(cur_line_output) + r.last_output = s.output.clone() + r.lines << r.line } } else { mut temp_line := r.line @@ -442,9 +444,7 @@ fn run_repl(workdir string, vrepl_prefix string) int { filter_line := r.line.replace(r.line.find_between("'", "'"), '').replace(r.line.find_between('"', '"'), '') mut is_statement := false - if func_call { - is_statement = true - } else if filter_line.count('=') % 2 == 1 + if filter_line.count('=') % 2 == 1 && (filter_line.count('!=') + filter_line.count('>=') + filter_line.count('<=')) == 0 { is_statement = true } else { @@ -467,6 +467,8 @@ fn run_repl(workdir string, vrepl_prefix string) int { if s.output.len > r.last_output.len { cur_line_output := s.output[r.last_output.len..] print_output(cur_line_output) + r.last_output = s.output.clone() + r.lines << temp_line } continue } diff --git a/vlib/v/slow_tests/repl/comptime_tmpl.repl b/vlib/v/slow_tests/repl/comptime_tmpl.repl index 0b0b6eb25ed3fb..b04d501aa9ef93 100644 --- a/vlib/v/slow_tests/repl/comptime_tmpl.repl +++ b/vlib/v/slow_tests/repl/comptime_tmpl.repl @@ -1,3 +1,3 @@ -print($tmpl('./tmpl/hello.txt')) +$tmpl('./tmpl/hello.txt') ===output=== hello diff --git a/vlib/v/slow_tests/repl/fn_calls.repl b/vlib/v/slow_tests/repl/fn_calls.repl index 8f3d8a39f78ad0..8d18dfbcc15019 100644 --- a/vlib/v/slow_tests/repl/fn_calls.repl +++ b/vlib/v/slow_tests/repl/fn_calls.repl @@ -1,4 +1,4 @@ -println(math.sinf(50.0)) +math.sinf(50.0) println(1+math.sinf(50.0)) fn test() { println('foo') } fn test2(a int) { println(a) } test() diff --git a/vlib/v/slow_tests/repl/import_alias.repl b/vlib/v/slow_tests/repl/import_alias.repl index 9ec5c9c1696285..85d68fe5140ebd 100644 --- a/vlib/v/slow_tests/repl/import_alias.repl +++ b/vlib/v/slow_tests/repl/import_alias.repl @@ -1,4 +1,4 @@ import encoding.hex as z -print(z.decode('AB09CD')!.hex()) +z.decode('AB09CD')!.hex() ===output=== ab09cd diff --git a/vlib/v/slow_tests/repl/method_call.repl b/vlib/v/slow_tests/repl/method_call1.repl similarity index 97% rename from vlib/v/slow_tests/repl/method_call.repl rename to vlib/v/slow_tests/repl/method_call1.repl index 2dce1f84bcdec1..de183683ff7f9f 100644 --- a/vlib/v/slow_tests/repl/method_call.repl +++ b/vlib/v/slow_tests/repl/method_call1.repl @@ -4,4 +4,5 @@ values.pop() values ===output=== [1, 2, 3] +3 [1, 2] diff --git a/vlib/v/slow_tests/repl/method_call2.repl b/vlib/v/slow_tests/repl/method_call2.repl new file mode 100644 index 00000000000000..dd92769fdf74a4 --- /dev/null +++ b/vlib/v/slow_tests/repl/method_call2.repl @@ -0,0 +1,8 @@ +mut values := [1, 2, 3] +values +println(values.pop()) +values +===output=== +[1, 2, 3] +3 +[1, 2]