-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy patherrors.feature
45 lines (41 loc) · 1.29 KB
/
errors.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Feature: Errors
Scenario: Run an erroneous code
Given a file named "main.cloe" with:
"""
(print (+ 1 true))
"""
When I run `cloe main.cloe`
Then the exit status should not be 0
And the stdout should contain exactly ""
And the stderr should contain "Error"
And the stderr should contain "main.cloe"
And the stderr should contain "(print (+ 1 true))"
Scenario: Bind 2 values to an argument
Given a file named "main.cloe" with:
"""
(def (f x)
(def (g y)
(def (h z) (+ x y z))
h)
g)
(print (((f 123) 456) . x 0))
"""
When I run `cloe main.cloe`
Then the exit status should not be 0
And the stdout should contain exactly ""
And the stderr should contain "Error"
Scenario: Catch an error
Given a file named "main.cloe" with:
"""
(print (catch (+ 1 true)))
"""
When I successfully run `cloe main.cloe`
Then the stdout should contain "name"
And the stdout should contain "message"
Scenario: Catch an error passed by match expression
Given a file named "main.cloe" with:
"""
(print (@ (catch (match (error "FooError" "") x (error "BarError" ""))) "name"))
"""
When I successfully run `cloe main.cloe`
Then the stdout should contain "FooError"