fOOrth/integration/stdio_lib_tests.rb

53 lines
1.1 KiB
Ruby
Raw Normal View History

# coding: utf-8
require_relative './support/foorth_testing'
2015-04-12 21:29:54 +02:00
gem 'minitest'
require 'minitest/autorun'
2014-12-20 01:17:23 +01:00
require 'minitest_visible'
#Test the standard fOOrth library.
2015-04-12 21:29:54 +02:00
class StdioLibraryTester < Minitest::Test
include XfOOrthTestExtensions
2014-12-20 01:17:23 +01:00
#Track mini-test progress.
MinitestVisible.track self, __FILE__
def test_the_dot
foorth_output('4 .', "4")
foorth_output('-4 .', "-4")
foorth_output('"test" .', "test")
foorth_output('Object .name .', "Object")
2014-10-22 21:14:54 +02:00
end
2014-10-22 21:14:54 +02:00
def test_the_dot_quote
foorth_output('."test"', "test")
end
2014-10-22 21:14:54 +02:00
def test_the_dot_cr
2015-01-25 20:35:39 +01:00
foorth_output('cr', "\n")
2014-10-22 21:14:54 +02:00
end
def test_the_space
foorth_output('space', " ")
end
def test_the_spaces
foorth_output('1 spaces', " ")
foorth_output('2 spaces', " ")
foorth_output('0 spaces', "")
foorth_raises('"apple" spaces')
end
def test_the_emit
foorth_output(' 65 .emit', "A")
foorth_output('126 .emit', "~")
foorth_utf8_output('255 .emit', [195, 191])
foorth_output(' "A123" .emit', "A")
foorth_raises('1+1i .emit')
end
end