summaryrefslogtreecommitdiff
path: root/test/visitors
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-10-07 09:32:58 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-10-07 09:32:58 -0700
commit762d889dc911c43274aa4c00104302d36e883add (patch)
tree9afd10778aea5ac53001a569d22d7452d7e5709d /test/visitors
parent2cf1f822b5e44308bb9e5af8ee4d75cfda0b4d9e (diff)
downloadpsych-762d889dc911c43274aa4c00104302d36e883add.zip
scalar regexp goes to ruby
Diffstat (limited to 'test/visitors')
-rw-r--r--test/visitors/test_to_ruby.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/visitors/test_to_ruby.rb b/test/visitors/test_to_ruby.rb
index 41eae48..7fd99a4 100644
--- a/test/visitors/test_to_ruby.rb
+++ b/test/visitors/test_to_ruby.rb
@@ -11,6 +11,17 @@ module Psych
@visitor = ToRuby.new
end
+ def test_regexp
+ node = Nodes::Scalar.new('/foo/', nil, '!ruby/regexp')
+ assert_equal(/foo/, node.to_ruby)
+
+ node = Nodes::Scalar.new('/foo/m', nil, '!ruby/regexp')
+ assert_equal(/foo/m, node.to_ruby)
+
+ node = Nodes::Scalar.new('/foo/ix', nil, '!ruby/regexp')
+ assert_equal(/foo/ix, node.to_ruby)
+ end
+
def test_time
now = Time.now
formatted = now.strftime("%Y-%m-%d %H:%M:%S") +