54 lines
1.5 KiB
YAML
54 lines
1.5 KiB
YAML
name: "Test Hello World"
|
|
description: "Test Hello World with specific Go and module versions"
|
|
inputs:
|
|
go-version:
|
|
description: "Go version being tested"
|
|
required: true
|
|
mod-version:
|
|
description: "Go module version to use"
|
|
required: true
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Test Hello World
|
|
shell: bash
|
|
run: |
|
|
echo "Testing with Go ${{ inputs.go-version }} and go.mod ${{ inputs.mod-version }}"
|
|
mkdir -p _test/helloworld && cd _test/helloworld
|
|
cat > go.mod << 'EOL'
|
|
module hello
|
|
go ${{ inputs.mod-version }}
|
|
EOL
|
|
cat > main.go << 'EOL'
|
|
package main
|
|
import (
|
|
"fmt"
|
|
"github.com/goplus/lib/c"
|
|
"github.com/goplus/lib/cpp/std"
|
|
)
|
|
func main() {
|
|
fmt.Println("Hello, LLGo!")
|
|
println("Hello, LLGo!")
|
|
c.Printf(c.Str("Hello, LLGo!\n"))
|
|
c.Printf(std.Str("Hello LLGo by cpp/std.Str\n").CStr())
|
|
}
|
|
EOL
|
|
go mod tidy
|
|
EXPECTED="Hello, LLGo!
|
|
Hello, LLGo!
|
|
Hello, LLGo!
|
|
Hello LLGo by cpp/std.Str"
|
|
OUTPUT=$(llgo run -v . 2>&1 | tee /dev/stderr)
|
|
if echo "$OUTPUT" | grep -qF "$EXPECTED"; then
|
|
echo "Basic test passed"
|
|
else
|
|
echo "Basic test failed"
|
|
echo "Expected to contain:"
|
|
echo "$EXPECTED"
|
|
echo "Got:"
|
|
echo "$OUTPUT"
|
|
exit 1
|
|
fi
|
|
|
|
#TODO(zzy): Test embed targets, need dispatch target dir
|