-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip(e2e): adding e2e test for running neva cli not from module's root
- Loading branch information
Showing
4 changed files
with
62 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package test | ||
|
||
// in this file we test files designed specifically for e2e. | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// Test that CLI will go from up to down and find module's manifest | ||
func Test_UpperThanManifest(t *testing.T) { | ||
// go one level up (and go back after test is finished) | ||
wd, err := os.Getwd() | ||
require.NoError(t, err) | ||
defer os.Chdir(wd) | ||
require.NoError(t, os.Chdir("..")) | ||
|
||
cmd := exec.Command("neva", "run", "run_cli_not_from_module_root/foo/bar") | ||
|
||
out, err := cmd.CombinedOutput() | ||
require.NoError(t, err) | ||
require.Equal( | ||
t, | ||
"42\n", | ||
string(out), | ||
) | ||
|
||
require.Equal(t, 0, cmd.ProcessState.ExitCode()) | ||
} | ||
|
||
// Test that CLI will go from down to up and find module's manifest | ||
func Test_DownToManifest(t *testing.T) { | ||
t.Skip() // FIXME https://github.com/nevalang/neva/issues/571 | ||
|
||
// go one level down (and go back after test is finished) | ||
wd, err := os.Getwd() | ||
require.NoError(t, err) | ||
defer os.Chdir(wd) | ||
require.NoError(t, os.Chdir("foo")) | ||
|
||
cmd := exec.Command("neva", "run", "bar") | ||
|
||
out, err := cmd.CombinedOutput() | ||
require.NoError(t, err) | ||
require.Equal( | ||
t, | ||
"42\n", | ||
string(out), | ||
) | ||
|
||
require.Equal(t, 0, cmd.ProcessState.ExitCode()) | ||
} |
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,4 @@ | ||
component Main(start) (stop) { | ||
nodes { Println } | ||
net { :start -> (42 -> println -> :stop) } | ||
} |
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 @@ | ||
neva: 0.10.0 |