Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Add test not compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeAbel committed Dec 18, 2023
1 parent 0c1c40d commit a6a0fcc
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/Spec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,46 @@ unitTestsComputeFunctions = testGroup "Tests compute functions"
assertEqual "(define (func x) (+ x 1)); (func 41)"
(Env {defines = [], errors = [], functions = [Function {name = "func", params = ["x"], bodies = [List [Symbol "+", Symbol "x", Number 1]]}]}, [Left (Just (Number 42))])
(computeAllAST (defaultEnv) [(List [Symbol "define", List [Symbol "func", Symbol "x"], List [Symbol "+", Symbol "x", Number 1]]), (List [Symbol "func", Number 41])])
, testCase "(define (fact n) (if (< n 2) 1 (* n (fact (- n 1))))); (fact 5)" $
assertEqual "(define (fact n) (if (< n 2) 1 (* n (fact (- n 1))))); (fact 5)"
(Env {
defines = [], errors = [], functions = [
Function {
name = "fact", params = ["n"], bodies = [
(List [
Symbol "if",
List [
Symbol "<", Symbol "n", Number 2],
Number 1,
List [
Symbol "*", Symbol "n",
List [
Symbol "fact", List [
Symbol "-", Symbol "n", Number 1]
]
]
]),
[

Check failure on line 286 in test/Spec.hs

View workflow job for this annotation

GitHub Actions / documentation

• Couldn't match expected type ‘Tree’

Check failure on line 286 in test/Spec.hs

View workflow job for this annotation

GitHub Actions / documentation

• Couldn't match expected type ‘Tree’
Left (Just (Number 120))
]
]
}
]
})
(computeAllAST (defaultEnv) [(List [

Check failure on line 293 in test/Spec.hs

View workflow job for this annotation

GitHub Actions / documentation

• Couldn't match expected type ‘Env’

Check failure on line 293 in test/Spec.hs

View workflow job for this annotation

GitHub Actions / documentation

• Couldn't match expected type ‘Env’
Symbol "if",
List [
Symbol "<", Symbol "n", Number 2],
Number 1,
List [
Symbol "*", Symbol "n",
List [
Symbol "fact", List [
Symbol "-", Symbol "n", Number 1]
]
]
]),
(List [Symbol "func", Number 5])])
]

unitTestsComputeConditions :: TestTree
Expand Down

0 comments on commit a6a0fcc

Please sign in to comment.