Skip to content

Commit

Permalink
Merge branch 'wip/jtulach/FnTypeError_7359' of enso:enso-org/enso int…
Browse files Browse the repository at this point in the history
…o wip/jtulach/FnTypeError_7359
  • Loading branch information
JaroslavTulach committed Aug 23, 2023
2 parents 735c691 + 5c2ef16 commit b1d58d9
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/Tests/src/Semantic/Error_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Standard.Test.Extensions

type My_Type
Value foo
Multi_Value foo bar

throw_a_bar = Error.throw "bar"
throw_a_bar_panicking = Panic.throw "bar"
Expand Down Expand Up @@ -348,18 +349,30 @@ spec =

neg n:Number = -n

extract x:My_Type = x.foo

Test.specify "everything is ok" <|
neg (my_func -5 -2) . should_equal 7

Test.specify "try to apply one argument" <|
r = Panic.recover Type_Error <| neg (my_func -5)
r . should_fail_with Type_Error
r.to_display_text.contains "Try to apply y argument" . should_be_true
r.to_display_text.should_contain "Try to apply y argument."

Test.specify "try to apply two arguments" <|
r = Panic.recover Type_Error <| neg my_func
r . should_fail_with Type_Error
r.to_display_text.contains "Try to apply x, y arguments" . should_be_true
r.to_display_text.should_contain "Try to apply x, y arguments."

Test.specify "report unapplied constructor nicely" <|
r = Panic.recover Type_Error <| extract My_Type.Value
r . should_fail_with Type_Error
r.to_display_text.should_contain "Try to apply foo argument."

Test.specify "report partially applied constructor nicely" <|
r = Panic.recover Type_Error <| extract (My_Type.Multi_Value 42)
r . should_fail_with Type_Error
r.to_display_text.should_contain "Try to apply bar argument."

Test.specify "try to apply two arguments with over-saturated" <|
r = Panic.recover Type_Error <| neg (my_func z=10)
Expand Down

0 comments on commit b1d58d9

Please sign in to comment.