Skip to content

Commit

Permalink
ci: fail if tests not ok
Browse files Browse the repository at this point in the history
  • Loading branch information
medvednikov committed Jul 29, 2024
1 parent 8b4a0c0 commit b72b183
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions expr.v
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module main

// Copyright (c) 2024 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by a GPL license that can be found in the LICENSE file.
module main

fn (mut app App) expr(expr Expr) {
match expr {
Expand Down
6 changes: 6 additions & 0 deletions main.v
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ const passing_tests = [
'defer',
'defer_multiple',
'map',
'if_nested',
]

struct App {
mut:
sb strings.Builder
is_fn_call bool // for lowercase idents
tests_ok bool
}

fn (mut app App) genln(s string) {
Expand Down Expand Up @@ -105,6 +107,7 @@ fn (mut app App) run_test(test_name string) ! {
println(term.green('OK'))
} else {
println('Test ${test_name} failed.')
app.tests_ok = false
println('Generated V code:')
println(generated_v_code)
if res.exit_code == 0 {
Expand Down Expand Up @@ -179,4 +182,7 @@ fn main() {
break
}
}
if !app.tests_ok {
exit(1)
}
}
2 changes: 2 additions & 0 deletions util.v
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright (c) 2024 Alexander Medvednikov. All rights reserved.
// Use of this source code is governed by a GPL license that can be found in the LICENSE file.
module main

fn go2v_type(typ string) string {
Expand Down

0 comments on commit b72b183

Please sign in to comment.