Changed emit to .emit and corrected tests.

This commit is contained in:
Peter Camilleri 2015-01-09 15:47:53 -05:00
parent 5e441d7802
commit b8f5f0935f
2 changed files with 11 additions and 5 deletions

View file

@ -38,10 +38,13 @@ class StdioLibraryTester < MiniTest::Unit::TestCase
end
def test_the_emit
foorth_output(' 65 emit', "A")
foorth_output('126 emit', "~")
foorth_output(' 65 .emit', "A")
foorth_output('126 .emit', "~")
foorth_utf8_output('255 emit', [195, 191])
foorth_utf8_output('255 .emit', [195, 191])
foorth_output(' "A123" .emit', "A")
foorth_raises('1+1i .emit')
end
end

View file

@ -30,8 +30,11 @@ module XfOOrth
#Print out a single character.
#[obj] emit []; print out the object as a character.
Object.create_shared_method('emit', TosSpec, [],
Numeric.create_shared_method('.emit', TosSpec, [],
&lambda {|vm| print self.to_foorth_c})
String.create_shared_method('.emit', TosSpec, [],
&lambda {|vm| print self.to_foorth_c})
Complex.create_shared_method('.emit', TosSpec, [:stub])
#Get a string from the console.
# [] accept [string]; gets a string from the console.