-
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.
Merge pull request #500 from nevalang/float_const_with_inst_lit
fix(compiler): analyzer pass float const with int lit and desugarer r…
- Loading branch information
Showing
15 changed files
with
264 additions
and
54 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
File renamed without changes.
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,5 @@ | ||
const x float = 1000 | ||
|
||
component Main(start) (stop) { | ||
net { :start -> :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 |
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,51 @@ | ||
//go:build e2e | ||
// +build e2e | ||
|
||
package test | ||
|
||
// in this file we only check that code in examples folder works as expected. | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestDoNothing(t *testing.T) { | ||
err := os.Chdir("../examples") | ||
require.NoError(t, err) | ||
|
||
cmd := exec.Command("neva", "run", "0_do_nothing") | ||
|
||
out, err := cmd.CombinedOutput() | ||
require.NoError(t, err) | ||
require.Equal( | ||
t, | ||
0, | ||
len(strings.TrimSpace(string(out))), | ||
) | ||
|
||
require.Equal(t, 0, cmd.ProcessState.ExitCode()) | ||
} | ||
|
||
func TestEcho(t *testing.T) { | ||
err := os.Chdir("../examples") | ||
require.NoError(t, err) | ||
|
||
cmd := exec.Command("neva", "run", "1_echo") | ||
|
||
cmd.Stdin = strings.NewReader("yo\n") | ||
out, err := cmd.CombinedOutput() | ||
require.NoError(t, err) | ||
|
||
require.Equal( | ||
t, | ||
"yo", | ||
strings.TrimSpace(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,33 @@ | ||
//go:build e2e | ||
// +build e2e | ||
|
||
package test | ||
|
||
// in this file we test files designed specifically for e2e. | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// There is special case where constant has float type but integer literal. | ||
func TestFloatConstWithIntLit(t *testing.T) { | ||
err := os.Chdir("./mod") | ||
require.NoError(t, err) | ||
|
||
cmd := exec.Command("neva", "run", "float_const_with_int_lit") | ||
|
||
out, err := cmd.CombinedOutput() | ||
require.NoError(t, err) | ||
require.Equal( | ||
t, | ||
0, | ||
len(strings.TrimSpace(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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
component Main(start any) (stop any) { | ||
component Main(start) (stop) { | ||
net { :start -> :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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
neva: 0.6.0 | ||
neva: 0.10.0 | ||
deps: | ||
github.com/nevalang/x: | ||
path: github.com/nevalang/x | ||
|
Oops, something went wrong.