From f034540449c7155d0daecae78e85f4e60b0b8343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Geron?= Date: Thu, 29 Aug 2024 22:47:29 +1200 Subject: [PATCH] Shorter error tag: OnlyPositiveIntegersAreAllowed (#58) --- exercises/practice/perfect-numbers/.meta/Example.roc | 2 +- exercises/practice/perfect-numbers/.meta/template.j2 | 2 +- exercises/practice/perfect-numbers/perfect-numbers-test.roc | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/practice/perfect-numbers/.meta/Example.roc b/exercises/practice/perfect-numbers/.meta/Example.roc index e2ce0ce..1c334b5 100644 --- a/exercises/practice/perfect-numbers/.meta/Example.roc +++ b/exercises/practice/perfect-numbers/.meta/Example.roc @@ -2,7 +2,7 @@ module [classify] aliquotSum = \number -> if number <= 0 then - Err ClassificationIsOnlyPossibleForPositiveIntegers + Err OnlyPositiveIntegersAreAllowed else if number == 1 then Ok 0 # edge case else diff --git a/exercises/practice/perfect-numbers/.meta/template.j2 b/exercises/practice/perfect-numbers/.meta/template.j2 index 60c573b..44b33b3 100644 --- a/exercises/practice/perfect-numbers/.meta/template.j2 +++ b/exercises/practice/perfect-numbers/.meta/template.j2 @@ -14,7 +14,7 @@ import {{ exercise | to_pascal }} exposing [classify] expect result = {{ case["property"] | to_camel }} {{ case["input"]["number"] }} {%- if case["expected"]["error"] %} - result == Err {{ case["expected"]["error"] | to_pascal }} + result == Err OnlyPositiveIntegersAreAllowed {%- else %} result == Ok {{ case["expected"] | to_pascal }} {%- endif %} diff --git a/exercises/practice/perfect-numbers/perfect-numbers-test.roc b/exercises/practice/perfect-numbers/perfect-numbers-test.roc index 1d4155b..a3f13c4 100644 --- a/exercises/practice/perfect-numbers/perfect-numbers-test.roc +++ b/exercises/practice/perfect-numbers/perfect-numbers-test.roc @@ -86,10 +86,10 @@ expect # Zero is rejected (as it is not a positive integer) expect result = classify 0 - result == Err ClassificationIsOnlyPossibleForPositiveIntegers + result == Err OnlyPositiveIntegersAreAllowed # Negative integer is rejected (as it is not a positive integer) expect result = classify -1 - result == Err ClassificationIsOnlyPossibleForPositiveIntegers + result == Err OnlyPositiveIntegersAreAllowed