2014-10-21 22:46:40 +02:00
|
|
|
# coding: utf-8
|
|
|
|
|
2014-11-03 23:43:45 +01:00
|
|
|
require_relative './support/foorth_testing'
|
2015-04-12 21:29:54 +02:00
|
|
|
gem 'minitest'
|
2014-11-04 06:26:00 +01:00
|
|
|
require 'minitest/autorun'
|
2014-12-20 01:17:23 +01:00
|
|
|
require 'minitest_visible'
|
2014-10-21 22:46:40 +02:00
|
|
|
|
|
|
|
#Test the standard fOOrth library.
|
2015-04-12 21:29:54 +02:00
|
|
|
class StdioLibraryTester < Minitest::Test
|
2014-10-21 22:46:40 +02:00
|
|
|
|
|
|
|
include XfOOrthTestExtensions
|
|
|
|
|
2014-12-20 01:17:23 +01:00
|
|
|
#Track mini-test progress.
|
|
|
|
MinitestVisible.track self, __FILE__
|
2014-10-21 22:46:40 +02:00
|
|
|
|
|
|
|
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
|
2015-01-25 20:35:39 +01:00
|
|
|
foorth_output('cr', "\n")
|
2014-10-22 21:14:54 +02:00
|
|
|
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', "")
|
2015-01-25 20:38:08 +01:00
|
|
|
foorth_raises('"apple" spaces')
|
2014-10-23 20:35:33 +02:00
|
|
|
end
|
|
|
|
|
2014-11-27 03:09:38 +01:00
|
|
|
def test_the_emit
|
2015-01-09 21:47:53 +01:00
|
|
|
foorth_output(' 65 .emit', "A")
|
|
|
|
foorth_output('126 .emit', "~")
|
2014-11-27 03:09:38 +01:00
|
|
|
|
2015-01-09 21:47:53 +01:00
|
|
|
foorth_utf8_output('255 .emit', [195, 191])
|
|
|
|
|
|
|
|
foorth_output(' "A123" .emit', "A")
|
|
|
|
foorth_raises('1+1i .emit')
|
2014-11-27 03:09:38 +01:00
|
|
|
end
|
|
|
|
|
2014-10-21 22:46:40 +02:00
|
|
|
end
|