summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-27 20:12:53 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-27 20:12:53 -0700
commit4cb2ba04833af82a4618f2ebd03372bddc2047f5 (patch)
tree4d4906c077cf6ef9079035e609fe73acc1f14f3a /test
parent9a8bfb1fe7a6c1443c31a0af36f30eb2f51d5515 (diff)
downloadpsych-4cb2ba04833af82a4618f2ebd03372bddc2047f5.zip
testing scalars
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_tree_builder.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/psych/test_tree_builder.rb b/test/psych/test_tree_builder.rb
index 0e3c59e..0b51a10 100644
--- a/test/psych/test_tree_builder.rb
+++ b/test/psych/test_tree_builder.rb
@@ -12,6 +12,7 @@ module Psych
bar : &A !!str baz,
boo : *A
}
+- baz
eoyml
@tree = @parser.handler.root
end
@@ -41,5 +42,28 @@ module Psych
assert_equal true, seq.implicit
assert_equal BLOCK_SEQUENCE_STYLE, seq.style
end
+
+ def test_scalar
+ doc = @tree.children.first
+ seq = doc.children.first
+
+ assert_equal 3, seq.children.length
+ scalar = seq.children.first
+ assert_instance_of Nodes::Scalar, scalar
+ assert_equal 'foo', scalar.value
+ assert_nil scalar.anchor
+ assert_nil scalar.tag
+ assert_equal true, scalar.plain
+ assert_equal false, scalar.quoted
+ assert_equal PLAIN_SCALAR_STYLE, scalar.style
+ end
+
+ def test_mapping
+ doc = @tree.children.first
+ seq = doc.children.first
+ map = seq.children[1]
+
+ assert_instance_of Nodes::Mapping, map
+ end
end
end