Skip to content

Commit

Permalink
Add test for safety checking
Browse files Browse the repository at this point in the history
  • Loading branch information
edusporto committed Jun 7, 2024
1 parent 607426d commit 0f44d07
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/programs/safety-check.hvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@List/Cons = (a (b ((@List/Cons/tag (a (b c))) c)))

@List/Cons/tag = 1

@List/Nil = ((@List/Nil/tag a) a)

@List/Nil/tag = 0

@id = (a a)

@list = c
& @List/Cons ~ (1 (b c))
& @List/Cons ~ (2 (@List/Nil b))

@main = b
& @map ~ (@main__C0 (a b))
& @List/Cons ~ (@id (@List/Nil a))

@main__C0 = (a b)
& @map ~ (a (@list b))

@map = (a ((@map__C1 (a b)) b))

@map__C0 = (* (a (d ({(a b) c} f))))
& @List/Cons ~ (b (e f))
& @map ~ (c (d e))

@map__C1 = (?(((* @List/Nil) @map__C0) a) a)

// Test flags
@test-rust-only = 1
6 changes: 6 additions & 0 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
source: tests/run.rs
expression: rust_output
input_file: tests/programs/safety-check.hvm
---
ERROR: attempt to clone a non-affine global reference.

0 comments on commit 0f44d07

Please sign in to comment.