From 5c2ef16c42b7efe52f48d968258ba091211ba441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Wa=C5=9Bko?= Date: Wed, 23 Aug 2023 12:17:51 +0200 Subject: [PATCH] proposing 'integration' test Current state: Type Errors: [4/5, 452ms] - everything is ok [1ms] - try to apply one argument [253ms] - try to apply two arguments [62ms] - [FAILED] report unapplied constructor nicely [77ms] Reason: The value (Error: Type error: expected `x` to be My_Type, but got Constructor.) did not contain the element (Try to apply foo argument.) (at C:\NBO\enso\test\Tests\src\Semantic\Error_Spec.enso:370:13-73). - report partially applied constructor nicely [56ms] --- test/Tests/src/Semantic/Error_Spec.enso | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/Tests/src/Semantic/Error_Spec.enso b/test/Tests/src/Semantic/Error_Spec.enso index d2389362cb9b..64ccc5358c69 100644 --- a/test/Tests/src/Semantic/Error_Spec.enso +++ b/test/Tests/src/Semantic/Error_Spec.enso @@ -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" @@ -348,17 +349,29 @@ 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." main = Test_Suite.run_main spec