Skip to content

Commit c690008

Browse files
authored
fix make_len, improve go2v_test.v, comment out complex_tests for now (#134)
1 parent 836bd66 commit c690008

File tree

6 files changed

+37
-24
lines changed

6 files changed

+37
-24
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ z
1818
#Intellij IDEA
1919
.idea/
2020
*.iml
21+
#VSCode
22+
.vscode/
23+
24+
#Temp conversion files
2125
**/*.json

fn_call.v

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ fn (mut app App) call_expr(call CallExpr) {
88
// fmt.Println => println
99
fun := call.fun
1010
if fun is SelectorExpr {
11-
if fun.x is Ident {
11+
if fun.sel.name == 'String' && fun.x is CallExpr {
12+
app.expr(fun.x)
13+
app.gen('.str()')
14+
return
15+
} else if fun.x is Ident {
1216
if fun.x.name == 'fmt' && fun.sel.name in ['Println', 'Print'] {
1317
fn_name = fun.sel.name.to_lower()
1418
is_println = true
@@ -149,7 +153,6 @@ fn (mut app App) selector_xxx(sel SelectorExpr) {
149153

150154
fn (mut app App) make_call(call CallExpr) {
151155
// app.genln('//make ${call.fun.type_name()} ar0=${call.args[0].type_name()}')
152-
app.force_upper = true
153156
app.expr(call.args[0])
154157
// len only
155158
if call.args.len == 2 {

go2v_test.v

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,47 @@ import strings
44
import os
55

66
fn test_all() {
7-
subdir := 'tests'
87
mut app := &App{
98
sb: strings.new_builder(1000)
109
}
1110

1211
// All tests
12+
mut tests_to_run := map[string][]string{}
13+
mut tests_failures := []string{}
14+
1315
mut test_names := os.ls('tests') or { return }
1416
test_names.sort()
15-
mut tests_failures := []string{}
16-
complex_names := os.ls('complex_tests/esbuild') or { return }
17-
assert complex_names.len > 0
18-
test_names << complex_names
19-
for test_name in test_names {
20-
println('='.repeat(44))
21-
create_json(subdir, test_name)
22-
// A separate instance for each test
23-
mut app2 := &App{
24-
sb: strings.new_builder(1000)
25-
}
26-
app2.run_test(subdir, test_name) or {
27-
eprintln('Error running test ${test_name}: ${err}')
28-
exit(1)
29-
}
30-
if !app2.tests_ok {
31-
tests_failures << test_name
17+
tests_to_run['tests'] = test_names
18+
19+
// mut complex_names := os.ls('complex_tests/esbuild') or { return }
20+
// if complex_names.len > 0 {
21+
// complex_names.sort()
22+
// tests_to_run['complex_tests/esbuild'] = complex_names
23+
// }
24+
25+
for subdir, tests in tests_to_run {
26+
for test_name in tests {
27+
println('='.repeat(44))
28+
create_json(subdir, test_name)
29+
// A separate instance for each test
30+
mut app2 := &App{
31+
sb: strings.new_builder(1000)
32+
}
33+
app2.run_test(subdir, test_name) or {
34+
eprintln('Error running test ${test_name}: ${err}')
35+
exit(1)
36+
}
37+
if !app2.tests_ok {
38+
tests_failures << '${subdir}/${test_name}'
39+
}
3240
}
3341
}
42+
3443
if tests_failures.len != 0 {
3544
eprintln('='.repeat(80))
3645
eprintln('Found ${tests_failures.len} go2v errors. Use the following commands to reproduce them in isolation:')
3746
for f in tests_failures {
38-
eprintln(' ./go2v ${subdir}/${f}')
47+
eprintln(' ./go2v ${f}')
3948
}
4049
exit(1)
4150
}

stmt.v

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ fn (mut app App) if_stmt(node IfStmt) {
106106
// else {
107107
else if node.else_ is BlockStmt {
108108
app.genln('else')
109-
if node.else_.list.len > 0 && node.else_.list[0] is IfStmt {
110-
app.genln('//LOOL')
111-
}
112109
app.block_stmt(node.else_)
113110
}
114111
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)