[804] MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb
Revision: 804 http://trac.macosforge.org/projects/ruby/changeset/804 Author: eloy.de.enige@gmail.com Date: 2009-01-21 01:47:51 -0800 (Wed, 21 Jan 2009) Log Message: ----------- Added failing test case for HotCocoa mappings after discussing with Vincent. Modified Paths: -------------- MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb Modified: MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb =================================================================== --- MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb 2009-01-21 00:34:04 UTC (rev 803) +++ MacRuby/trunk/test-macruby/cases/hotcocoa/mappings_test.rb 2009-01-21 09:47:51 UTC (rev 804) @@ -19,7 +19,12 @@ class TestMappings < Test::Unit::TestCase include HotCocoa - + + after do + Mappings.mappings[:klass] = nil + Mappings.frameworks["theframework"] = nil + end + it "should have two Hash attributes named #mappings and #frameworks" do assert Mappings.mappings.is_a?(Hash) assert Mappings.frameworks.is_a?(Hash) @@ -82,6 +87,22 @@ end end + it "should resolve a constant when a framework, that's registered with #map, is loaded" do + assert_nothing_raised(NameError) do + Mappings.map(:klass => 'ClassFromFramework', :framework => 'TheFramework') {} + end + + # The mapping should not yet exist + assert_nil Mappings.mappings[:klass] + + # now we actually define the class and fake the loading of the framework + eval "class ::ClassFromFramework; end" + Mappings.framework_loaded('TheFramework') + + # It should be loaded by now + assert_equal ClassFromFramework, Mappings.mappings[:klass].control_class + end + def test_reload flunk 'Pending.' end
participants (1)
-
source_changes@macosforge.org