Skip to content

Commit fac8da8

Browse files
committed
Circular reference test
1 parent 02b099b commit fac8da8

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
name = "echo_circular_reference"
2+
version = "1.0.0"
3+
target = "javascript"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pub fn main() {
2+
echo circular_reference()
3+
Nil
4+
}
5+
6+
type Thing
7+
8+
@external(javascript, "./main_ffi.mjs", "circular_reference")
9+
fn circular_reference() -> Thing
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export function circular_reference() {
2+
const x = [];
3+
x.push(x);
4+
return x;
5+
}

test-output/src/tests/echo.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,8 @@ fn echo_tuple() {
195195
fn echo_non_record_atom_tag() {
196196
assert_echo!(Target::Erlang, "echo_non_record_atom_tag");
197197
}
198+
199+
#[test]
200+
fn echo_circular_reference() {
201+
assert_echo!(Target::JavaScript, "echo_circular_reference");
202+
}

test-output/src/tests/snapshots/test_output__tests__echo__javascript-echo_circular_reference.snap

Lines changed: 21 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)