failing test

This commit is contained in:
Gregory Travis 2024-07-29 13:52:31 -04:00
parent a638d8e54e
commit bf9cb84fe5

View File

@ -1,5 +1,6 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Incomparable_Values
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
polyglot java import org.enso.base.ObjectComparator
@ -36,6 +37,18 @@ type No_Ord_Comparator
Comparable.from (that:No_Ord) = Comparable.new that No_Ord_Comparator
type Attach_Warning
Value (n : Integer)
type Attach_Warning_Comparator
compare (x : Attach_Warning) (y : Attach_Warning) =
r = Ordering.compare x.n y.n
Warning.attach (Illegal_Argument.Error "warning") r
hash x:Attach_Warning = Ordering.hash x.n
Comparable.from (that : Attach_Warning) = Comparable.new that Attach_Warning_Comparator
# Tests
add_specs suite_builder = suite_builder.group "Object Comparator" group_builder->
@ -81,6 +94,12 @@ add_specs suite_builder = suite_builder.group "Object Comparator" group_builder-
(default_comparator 1 True) . should_fail_with Incomparable_Values
(default_comparator (No_Ord.Value 1) (No_Ord.Value 2)).should_fail_with Incomparable_Values
group_builder.specify "warnings attached in a comparator should propagate to the operator result" <|
Problems.expect_only_warning Illegal_Argument <| ((Attach_Warning.Value 1) < (Attach_Warning.Value 2))
Problems.expect_only_warning Illegal_Argument <| ((Attach_Warning.Value 1) >= (Attach_Warning.Value 2))
# TODO: https://github.com/enso-org/enso/issues/10679
# Problems.expect_only_warning Illegal_Argument <| ((Attach_Warning.Value 1) == (Attach_Warning.Value 2))
main filter=Nothing =
suite = Test.build suite_builder->
add_specs suite_builder