mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-14 11:08:13 +08:00
b6d69d0b30
The progtest package now provides a declarative framework, modelled after pkg/eval/evaltest. Tests that use progtest are now much more concise.
24 lines
617 B
Go
24 lines
617 B
Go
package buildinfo
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
. "src.elv.sh/pkg/prog/progtest"
|
|
)
|
|
|
|
func TestProgram(t *testing.T) {
|
|
Test(t, Program,
|
|
ThatElvish("-version").WritesStdout(Value.Version+"\n"),
|
|
ThatElvish("-version", "-json").WritesStdout(mustToJSON(Value.Version)+"\n"),
|
|
|
|
ThatElvish("-buildinfo").WritesStdout(
|
|
fmt.Sprintf(
|
|
"Version: %v\nGo version: %v\nReproducible build: %v\n",
|
|
Value.Version, Value.GoVersion, Value.Reproducible)),
|
|
ThatElvish("-buildinfo", "-json").WritesStdout(mustToJSON(Value)+"\n"),
|
|
|
|
ThatElvish().ExitsWith(2).WritesStderr("internal error: no suitable subprogram\n"),
|
|
)
|
|
}
|