add unit test
This commit is contained in:
parent
47f1b10370
commit
3d8cc9c38c
@ -19,6 +19,9 @@ tasks:
|
|||||||
shellcheck -x $(awk '/#!\/bin\/(ba)?sh/&&FNR==1{print FILENAME}' $(git ls-files))
|
shellcheck -x $(awk '/#!\/bin\/(ba)?sh/&&FNR==1{print FILENAME}' $(git ls-files))
|
||||||
bazel run //:buildifier
|
bazel run //:buildifier
|
||||||
git diff --exit-code
|
git diff --exit-code
|
||||||
|
- test_native: |
|
||||||
|
cd bazel-zig-cc; . .envrc
|
||||||
|
bazel test //...
|
||||||
- test_list_toolchains: |
|
- test_list_toolchains: |
|
||||||
cd bazel-zig-cc; . .envrc; echo "Available toolchains:"
|
cd bazel-zig-cc; . .envrc; echo "Available toolchains:"
|
||||||
bazel query @zig_sdk//... | sed -En '/.*_toolchain$/ s/.*:(.*)_toolchain$/\1/p'
|
bazel query @zig_sdk//... | sed -En '/.*_toolchain$/ s/.*:(.*)_toolchain$/\1/p'
|
||||||
|
@ -18,7 +18,7 @@ go_binary(
|
|||||||
)
|
)
|
||||||
|
|
||||||
go_test(
|
go_test(
|
||||||
name = "test_test",
|
name = "hello_test",
|
||||||
srcs = ["hello_test.go"],
|
srcs = ["hello_test.go"],
|
||||||
embed = [":test_lib"],
|
embed = [":hello_lib"],
|
||||||
)
|
)
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// #include <stdio.h>
|
// #include <stdio.h>
|
||||||
// char* hello() { return "hello, world\n"; }
|
// char* hello() { return "hello, world"; }
|
||||||
// void printhello() { printf(hello()); }
|
// void printhello() { printf("%s\n", hello()); }
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
11
test/hello_test.go
Normal file
11
test/hello_test.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestHello(t *testing.T) {
|
||||||
|
want := "hello, world"
|
||||||
|
got := chello()
|
||||||
|
if got != want {
|
||||||
|
t.Errorf("expected %q, got %q", want, got)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user