Skip to content

Commit

Permalink
fix(e2e,examples): everything fixed except filter list example
Browse files Browse the repository at this point in the history
  • Loading branch information
emil14 committed Nov 14, 2024
1 parent ba82d1e commit b6fabdf
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 30 deletions.
4 changes: 2 additions & 2 deletions e2e/non_unique_fan_out/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ func Test(t *testing.T) {
out, err := cmd.CombinedOutput()
require.NoError(t, err)

require.Equal(
require.Contains(
t,
"main/main.neva:4:10: port 'in:start' is used twice\n",
string(out),
"main/main.neva:2:10: port 'in:start' is used twice\n",
)

require.Equal(t, 0, cmd.ProcessState.ExitCode())
Expand Down
2 changes: 0 additions & 2 deletions e2e/non_unique_fan_out/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { io }

def Main(start any) (stop any) {
[:start, :start] -> :stop
}
2 changes: 2 additions & 0 deletions e2e/order_dependend_with_arr_inport/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { fmt }

const l list<int> = [1, 2, 3]

def Main(start) (stop) {
Expand Down
2 changes: 2 additions & 0 deletions e2e/print_float/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { fmt }

const x float = 42

def Main(start) (stop) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/regex_submatch_verbose/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { regexp }
import { regexp, fmt }

def Main(start) (stop) {
fmt.Println, regexp.Submatch, Panic
Expand Down
2 changes: 2 additions & 0 deletions e2e/run_cli_not_from_module_root/foo/bar/main.neva
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { fmt }

def Main(start) (stop) {
fmt.Println
---
Expand Down
2 changes: 1 addition & 1 deletion e2e/simple_fan_out/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { time }
import { time, fmt }

def Main(start) (stop) {
p1 fmt.Println
Expand Down
6 changes: 3 additions & 3 deletions e2e/slow_iteration_with_for/main/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// https://github.com/nevalang/neva/issues/575
// all elements of the array must be printed befofe program terminate

import { time }
import { time, fmt }

const lst list<int> = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

Expand All @@ -13,8 +13,8 @@ def Main(start) (stop) {
}

def Slow(data int) (sig any) {
time.Delay
fmt.Println
time.Delay<int>
fmt.Println<int>
---
:data -> delay:data
$time.second -> delay:dur
Expand Down
6 changes: 3 additions & 3 deletions e2e/slow_iteration_with_map/main/main.neva
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// https://github.com/nevalang/neva/issues/575
// all elements of the array must be printed befofe program terminate

import { time }
import { time, fmt }

const lst list<int> = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

def Main(start) (stop) {
ListToStream<int>
Map<int, int>{Slow}
List
fmt.Println
List<int>
fmt.Println<list<int>>
---
:start -> {
$lst -> listToStream -> map -> list -> println -> :stop
Expand Down
6 changes: 4 additions & 2 deletions e2e/struct_selector_on_port_addr/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { fmt }

def Main(start) (stop) {
Foo, fmt.Println<int>
---
:start -> foo:sig
foo:msg.a -> println:data
foo:msg -> .a -> println:data
println:sig -> :stop
}

const s struct { a int } = { a: 42 }

def Foo(sig any) (msg struct{a int}) {
:sig -> { $s -> :msg }
}
}
2 changes: 2 additions & 0 deletions e2e/struct_selector_verbose/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { fmt }

// Here we learn how to read struct field
// by using builtin def with compiler directive.

Expand Down
2 changes: 1 addition & 1 deletion examples/filter_list/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Test(t *testing.T) {
defer os.Chdir(wd)

for i := 0; i < 1; i++ {
cmd := exec.Command("neva", "run", "filter_list")
cmd := exec.Command("neva", "run", "-trace", "filter_list")

// Set a timeout for the command
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
Expand Down
15 changes: 0 additions & 15 deletions examples/filter_list/main.neva
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
import { fmt }

const lst list<int> = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

def Main(start) (stop) {
ListToStream, Filter{Even}, For{fmt.Println}, Wait
---
:start -> {
$lst -> listToStream -> filter -> for -> wait -> :stop
}
}

def Even(data int) (res bool) {
((:data % 2) == 0) -> :res
}

0 comments on commit b6fabdf

Please sign in to comment.