-
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This makes use of the support for collecting code coverage from binaries added in Go 1.20: https://go.dev/blog/integration-test-coverage - Add a new "e2e" directory containing end-to-end tests. - Change the "cover" Make target to run E2E tests and merge the coverage with unit tests. - Change the CI task on GitHub Actions to run those E2E tests, and upload them separately to CodeCov with an "e2e" flag. (Unit tests now get the "unit" flag.)
- Loading branch information
Showing
5 changed files
with
80 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package e2e_test | ||
|
||
import ( | ||
"embed" | ||
"testing" | ||
|
||
"src.elv.sh/pkg/eval" | ||
"src.elv.sh/pkg/eval/evaltest" | ||
"src.elv.sh/pkg/eval/vars" | ||
"src.elv.sh/pkg/parse" | ||
"src.elv.sh/pkg/testutil" | ||
) | ||
|
||
//go:embed *.elvts | ||
var transcripts embed.FS | ||
|
||
const buildScript = ` | ||
go build (if (not-eq $E:GOCOVERDIR '') { put -cover }) -o $workdir/elvish src.elv.sh/cmd/elvish | ||
` | ||
|
||
func TestTranscripts(t *testing.T) { | ||
workdir := t.TempDir() | ||
err := eval.NewEvaler().Eval( | ||
parse.Source{Name: "[build]", Code: buildScript}, | ||
eval.EvalCfg{ | ||
Global: eval.BuildNs().AddVars(map[string]vars.Var{ | ||
"workdir": vars.NewReadOnly(workdir), | ||
}).Ns()}) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
testutil.Chdir(t, workdir) | ||
|
||
evaltest.TestTranscriptsInFS(t, transcripts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
////////////// | ||
# run script # | ||
////////////// | ||
|
||
# with -c # | ||
~> ./elvish -c 'echo hello from -c' | ||
hello from -c | ||
|
||
# with file # | ||
~> echo 'echo hello from file' > script.elv | ||
./elvish script.elv | ||
hello from file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters