Skip to content

Commit

Permalink
Fix bats tests
Browse files Browse the repository at this point in the history
  • Loading branch information
upamanyus committed Jul 16, 2024
1 parent e3167fd commit 5acaeb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 38 deletions.
30 changes: 4 additions & 26 deletions test/goose.bats
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ assert_file_not_exist() {

@test "goose grove_ffi" {
goose -out Goose ./use_grove
run cat "$OUT"/m/use__grove.v
run cat "$OUT"/m/use_grove.v
assert_output --partial "grove_prelude"
}

Expand All @@ -80,28 +80,18 @@ assert_file_not_exist() {
assert_output --partial "could not load package"
}

@test "goose with one error" {
run goose -out Goose ./use_grove ./errors/not_goose
# fails, but does output correct file
assert_failure
assert_file_exists "$OUT"/m/use__disk.v
assert_file_not_exist "$OUT"/m/errors/not__goose.v
assert_file_not_exist "$OUT"/m.v
}

@test "goose with build tag to suppress bad code" {
goose -out Goose ./errors/build_tag
run cat "$OUT"/m/errors/build__tag.v
run cat "$OUT"/m/errors/build_tag.v
assert_output --partial "Definition Foo"
refute_output --partial "WontTranslate"
}

@test "goose on ./..." {
run goose -out Goose ./...
assert_failure
assert_file_exists "$OUT"/m.v
assert_file_exists "$OUT"/m/use__disk.v
assert_file_exists "$OUT"/m/errors/build__tag.v
assert_file_exists "$OUT"/m/use_disk.v
assert_file_exists "$OUT"/m/errors/build_tag.v
}

@test "goose on external package" {
Expand Down Expand Up @@ -130,18 +120,6 @@ assert_file_not_exist() {
assert_file_not_exist "$OUT"/m/use_disk.v
}

@test "goose -ignore-errors" {
run goose -out Goose -ignore-errors ./errors/not_goose
# even -ignore-errors sets an error status
assert_failure
run cat "$OUT"/m/errors/not__goose.v
# the top-level comment and other definitions should translate
assert_output --partial "not_goose has code"
assert_output --partial "Definition Number"
refute_output --partial "Bad"
assert_output --partial "Definition Ok"
}

@test "goose after change" {
run goose -out Goose
sed -i~ 's/UseMarshal/ExampleFunc/' m.go
Expand Down
12 changes: 0 additions & 12 deletions testdata/goose-tests/errors/not_goose/not_goose.go

This file was deleted.

0 comments on commit 5acaeb2

Please sign in to comment.