This repository has been archived by the owner on Feb 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from stealthrocket/fix-timecraft-run-from-defa…
…ult-config timecraft: fix run from default config
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 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,33 @@ | ||
package main_test | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/stealthrocket/timecraft/internal/assert" | ||
) | ||
|
||
var run = tests{ | ||
"show the run command help with the short option": func(t *testing.T) { | ||
stdout, stderr, err := timecraft(t, "run", "-h") | ||
assert.OK(t, err) | ||
assert.HasPrefix(t, stdout, "Usage:\ttimecraft run ") | ||
assert.Equal(t, stderr, "") | ||
}, | ||
|
||
"show the run command help with the long option": func(t *testing.T) { | ||
stdout, stderr, err := timecraft(t, "run", "--help") | ||
assert.OK(t, err) | ||
assert.HasPrefix(t, stdout, "Usage:\ttimecraft run ") | ||
assert.Equal(t, stderr, "") | ||
}, | ||
|
||
"running with a configuration file which does not exist uses the default location": func(t *testing.T) { | ||
t.Setenv("TIMECRAFTCONFIG", filepath.Join(t.TempDir(), "path", "to", "nowehere.yaml")) | ||
|
||
stdout, stderr, err := timecraft(t, "run", "./testdata/go/sleep.wasm", "0") | ||
assert.OK(t, err) | ||
assert.Equal(t, stdout, "sleeping for 0s\n") | ||
assert.NotEqual(t, stderr, "") | ||
}, | ||
} |