From 052b652f5ed5d59000d9f61c374e349cef9f75ef Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Mon, 16 Oct 2017 23:20:47 +0200 Subject: [PATCH] Optional.absent() != Optional.absent() (#373) --- lib/src/core/optional.dart | 2 +- test/core/optional_test.dart | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/core/optional.dart b/lib/src/core/optional.dart index d7496cce..5567147d 100644 --- a/lib/src/core/optional.dart +++ b/lib/src/core/optional.dart @@ -98,7 +98,7 @@ class Optional extends IterableBase { int get hashCode => _value.hashCode; /// Delegates to the underlying [value] operator==. - bool operator ==(o) => o is Optional && o._value == _value; + bool operator ==(o) => o is Optional && o._value == _value; String toString() { return _value == null diff --git a/test/core/optional_test.dart b/test/core/optional_test.dart index f1a71282..46f9a7a9 100644 --- a/test/core/optional_test.dart +++ b/test/core/optional_test.dart @@ -99,6 +99,10 @@ main() { expect(new Optional.of(7), equals(new Optional.of(7))); expect(new Optional.fromNullable(null), equals(new Optional.fromNullable(null))); + expect( + new Optional.fromNullable(null) == + new Optional.fromNullable(null), + isFalse); expect(new Optional.fromNullable(null), isNot(equals(new Optional.of(7)))); expect(new Optional.of(7), isNot(equals(new Optional.of(8))));