test/simple/lazy_test.rb in simple-lazy-1.0.0 vs test/simple/lazy_test.rb in simple-lazy-1.0.1

- old
+ new

@@ -1,6 +1,7 @@ require "minitest/autorun" +require_relative "../../lib/simple/lazy" class TestSimpleLazy < Minitest::Test def test_1 assert_equal(1, Simple::Lazy.new(1) { }.value) assert_equal(false, Simple::Lazy.new(1) { }.cached?) @@ -21,20 +22,27 @@ begin lazy = Simple::Lazy.new(1) { |id| raise 'oops' } lazy.inspect lazy.value lazy.cached? - lazy == lazy - [lazy, lazy].sort + [lazy, lazy, (lazy == lazy) && 1, lazy.eql?(lazy) && 1].sort lazy.hash rescue => e error = e + puts error.backtrace end assert_nil(error) end def test_4 lazy = Simple::Lazy.new(1) { |id| "oh" } assert_equal("oh", lazy.to_s) + end + + def test_5 + lazy = Simple::Lazy.new(1) { nil } + assert_equal(false, lazy.cached?) + assert_equal("", lazy.to_s) + assert_equal(true, lazy.cached?) end end