Sha256: 59765ed02f9c5cbe0bb1c9d084b4654ebbf929e8bb6e430d51a04199a2098c7f
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
#! /usr/bin/ruby #encoding: utf-8 require 'minitest/autorun' describe "respond_to" do before do require './../lib/y_support/misc/respond_to' end describe Object do it "should have RespondTo() constructor" do assert_equal RespondTo, RespondTo( :inspect ).class end end describe "RespondTo" do it "should work" do assert_respond_to( RespondTo.new(:hello), :=== ) assert RespondTo.new(:each_char) === "arbitrary string" assert ! ( RespondTo.new(:each_char) === Object.new ) assert ! ( RespondTo.new(:improbab_method_name) === Object.new ) # Now testing the intended RespondTo usage in case statements. assert case ?x when RespondTo.new(:each_char) then 1 else false end assert ! case ?x when RespondTo.new(:improbab_method_name) then 1 else false end end end describe Symbol do it "should have Symbol#~@ for .respond_to? case statements" do assert_kind_of RespondTo, ~:hello assert RespondTo(:<<) === "testing" assert case ?x when ~:each_char then 1 else false end assert ! case ?x when ~:improbab_method_name then 1 else false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
y_support-2.5.3 | test/misc/respond_to_test.rb |
y_support-2.5.2 | test/misc/respond_to_test.rb |
y_support-2.5.1 | test/misc/respond_to_test.rb |