Skip to content

Commit

Permalink
Add test for using prim names as variable names not getting broken du…
Browse files Browse the repository at this point in the history
…ring preprocessing
  • Loading branch information
prozacchiwawa committed Jan 14, 2024
1 parent 0a3a51a commit fdda6aa
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/tests/module/std/prepend.clinc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(defun prepend (a b)
(if a
(c (f a) (prepend (r a) b))
b
)
)
4 changes: 4 additions & 0 deletions resources/tests/module/test_prepend.clsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(include *standard-cl-23*)

(import std.prepend)
(export (X Y) (prepend X Y))
17 changes: 17 additions & 0 deletions src/tests/compiler/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,20 @@ fn test_simple_module_compliation_simple_type_2() {
}],
);
}

#[test]
fn test_function_with_argument_names_overlapping_primitives() {
let filename = "resources/tests/module/test_prepend.clsp";
let content = fs::read_to_string(filename).expect("file should exist");
let hex_filename = "resources/tests/module/test_prepend.hex";

test_compile_and_run_program_with_modules(
filename,
&content,
&[HexArgumentOutcome {
hexfile: hex_filename,
argument: "((1 2 3) (4 5 6))",
outcome: Some("(q 2 3 4 5 6)"),
}],
);
}

0 comments on commit fdda6aa

Please sign in to comment.