summaryrefslogtreecommitdiff
path: root/jni/ruby/test/ripper/test_ripper.rb
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/test/ripper/test_ripper.rb
Fresh start
Diffstat (limited to 'jni/ruby/test/ripper/test_ripper.rb')
-rw-r--r--jni/ruby/test/ripper/test_ripper.rb63
1 files changed, 63 insertions, 0 deletions
diff --git a/jni/ruby/test/ripper/test_ripper.rb b/jni/ruby/test/ripper/test_ripper.rb
new file mode 100644
index 0000000..1544e56
--- /dev/null
+++ b/jni/ruby/test/ripper/test_ripper.rb
@@ -0,0 +1,63 @@
+begin
+ require 'ripper'
+ require 'test/unit'
+ ripper_test = true
+ module TestRipper; end
+rescue LoadError
+end
+
+class TestRipper::Ripper < Test::Unit::TestCase
+
+ def setup
+ @ripper = Ripper.new '1 + 1'
+ end
+
+ def test_column
+ assert_nil @ripper.column
+ end
+
+ def test_encoding
+ assert_equal Encoding::UTF_8, @ripper.encoding
+ ripper = Ripper.new('# coding: iso-8859-15')
+ ripper.parse
+ assert_equal Encoding::ISO_8859_15, ripper.encoding
+ ripper = Ripper.new('# -*- coding: iso-8859-15 -*-')
+ ripper.parse
+ assert_equal Encoding::ISO_8859_15, ripper.encoding
+ end
+
+ def test_end_seen_eh
+ @ripper.parse
+ assert_not_predicate @ripper, :end_seen?
+ ripper = Ripper.new('__END__')
+ ripper.parse
+ assert_predicate ripper, :end_seen?
+ end
+
+ def test_filename
+ assert_equal '(ripper)', @ripper.filename
+ filename = "ripper"
+ ripper = Ripper.new("", filename)
+ filename.clear
+ assert_equal "ripper", ripper.filename
+ end
+
+ def test_lineno
+ assert_nil @ripper.lineno
+ end
+
+ def test_parse
+ assert_nil @ripper.parse
+ end
+
+ def test_yydebug
+ assert_not_predicate @ripper, :yydebug
+ end
+
+ def test_yydebug_equals
+ @ripper.yydebug = true
+
+ assert_predicate @ripper, :yydebug
+ end
+
+end if ripper_test