2014-10-21 22:46:40 +02:00
|
|
|
# coding: utf-8
|
|
|
|
|
2014-11-03 23:43:45 +01:00
|
|
|
require_relative './support/foorth_testing'
|
2014-11-04 06:26:00 +01:00
|
|
|
require 'minitest/autorun'
|
2014-10-21 22:46:40 +02:00
|
|
|
|
|
|
|
#Test the standard fOOrth library.
|
2014-11-04 06:26:00 +01:00
|
|
|
class StdioLibraryTester < MiniTest::Unit::TestCase
|
2014-10-21 22:46:40 +02:00
|
|
|
|
|
|
|
include XfOOrthTestExtensions
|
|
|
|
|
|
|
|
#Special initialize to track rake progress.
|
|
|
|
def initialize(*all)
|
|
|
|
$do_this_only_one_time = "" unless defined? $do_this_only_one_time
|
|
|
|
|
|
|
|
if $do_this_only_one_time != __FILE__
|
|
|
|
puts
|
|
|
|
puts "Running test file: #{File.split(__FILE__)[1]}"
|
|
|
|
$do_this_only_one_time = __FILE__
|
|
|
|
end
|
|
|
|
|
|
|
|
super(*all)
|
|
|
|
end
|
|
|
|
|
|
|
|
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-21 22:46:40 +02:00
|
|
|
|
2014-10-22 21:14:54 +02:00
|
|
|
def test_the_dot_quote
|
2014-10-21 22:46:40 +02:00
|
|
|
foorth_output('."test"', "test")
|
|
|
|
end
|
2014-10-22 21:14:54 +02:00
|
|
|
|
|
|
|
def test_the_dot_cr
|
|
|
|
foorth_output('.cr', "\n")
|
|
|
|
end
|
|
|
|
|
2014-10-23 20:35:33 +02:00
|
|
|
def test_the_space
|
|
|
|
foorth_output('space', " ")
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_the_spaces
|
|
|
|
foorth_output('1 spaces', " ")
|
|
|
|
foorth_output('2 spaces', " ")
|
|
|
|
foorth_output('0 spaces', "")
|
|
|
|
end
|
|
|
|
|
2014-11-27 03:09:38 +01:00
|
|
|
def test_the_emit
|
|
|
|
foorth_output(' 65 emit', "A")
|
|
|
|
foorth_output('126 emit', "~")
|
|
|
|
|
2014-11-27 03:43:52 +01:00
|
|
|
foorth_utf8_output('255 emit', [195, 191])
|
2014-11-27 03:09:38 +01:00
|
|
|
end
|
|
|
|
|
2014-10-21 22:46:40 +02:00
|
|
|
end
|