test(build):case with llgo test ./...
This commit is contained in:
3
.github/workflows/llgo.yml
vendored
3
.github/workflows/llgo.yml
vendored
@@ -137,8 +137,7 @@ jobs:
|
||||
go-version: ${{matrix.go}}
|
||||
|
||||
- name: run llgo test
|
||||
run: |
|
||||
llgo test ./...
|
||||
run: bash .github/workflows/llgo_test.sh
|
||||
|
||||
hello:
|
||||
continue-on-error: true
|
||||
|
||||
17
.github/workflows/llgo_test.sh
vendored
Normal file
17
.github/workflows/llgo_test.sh
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
output=$(llgo test ./... 2>&1)
|
||||
echo "$output"
|
||||
|
||||
pass_count=$(echo "$output" | grep -c "^PASS$")
|
||||
echo "llgo test pass count: $pass_count"
|
||||
|
||||
if [ "$pass_count" -gt 1 ]; then
|
||||
echo "llgo test ./... passed"
|
||||
exit 0
|
||||
else
|
||||
echo "llgo test ./... failed: PASS count is not greater than 1"
|
||||
exit 1
|
||||
fi
|
||||
@@ -58,6 +58,7 @@ func TestRun(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTest(t *testing.T) {
|
||||
// fixme:with builtin package test in a llgo test ./... will cause duplicate symbol error
|
||||
mockRun([]string{"../../cl/_testgo/runtest"}, &Config{Mode: ModeTest})
|
||||
}
|
||||
|
||||
|
||||
5
test/bar/bar.go
Normal file
5
test/bar/bar.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package bar
|
||||
|
||||
func Bar() int {
|
||||
return 2
|
||||
}
|
||||
13
test/bar/bar_test.go
Normal file
13
test/bar/bar_test.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package bar_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/goplus/llgo/test/bar"
|
||||
)
|
||||
|
||||
func TestBar(t *testing.T) {
|
||||
if bar.Bar() != 2 {
|
||||
t.Fatal("Bar() != 2")
|
||||
}
|
||||
}
|
||||
5
test/bar/barinner/barinner.go
Normal file
5
test/bar/barinner/barinner.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package barinner
|
||||
|
||||
func BarInner() int {
|
||||
return 2
|
||||
}
|
||||
13
test/bar/barinner/barinner_test.go
Normal file
13
test/bar/barinner/barinner_test.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package barinner_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/goplus/llgo/test/bar/barinner"
|
||||
)
|
||||
|
||||
func TestBarInner(t *testing.T) {
|
||||
if barinner.BarInner() != 2 {
|
||||
t.Fatal("BarInner() != 2")
|
||||
}
|
||||
}
|
||||
5
test/foo/foo.go
Normal file
5
test/foo/foo.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package foo
|
||||
|
||||
func Foo() int {
|
||||
return 1
|
||||
}
|
||||
13
test/foo/foo_test.go
Normal file
13
test/foo/foo_test.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package foo_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/goplus/llgo/test/foo"
|
||||
)
|
||||
|
||||
func TestFoo(t *testing.T) {
|
||||
if foo.Foo() != 1 {
|
||||
t.Fatal("Foo() != 1")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user