summaryrefslogtreecommitdiff
path: root/test/psych/test_tree_builder.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-27 03:11:18 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-27 03:11:18 +0000
commitb613a2c5ae03c425bc94771e4eced1b80e4e80d0 (patch)
treea2bd8c92dbafcc5897e4105682517df190e35f3f /test/psych/test_tree_builder.rb
parent33201294eb59f10ccb98752207c2cc9d1c8757cc (diff)
Merge psych-3.0.0.beta4 from upstream.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych/test_tree_builder.rb')
-rw-r--r--test/psych/test_tree_builder.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/psych/test_tree_builder.rb b/test/psych/test_tree_builder.rb
index 3e35788e35..dfb5da9892 100644
--- a/test/psych/test_tree_builder.rb
+++ b/test/psych/test_tree_builder.rb
@@ -21,6 +21,7 @@ module Psych
def test_stream
assert_instance_of Nodes::Stream, @tree
+ assert_location 0, 0, 8, 0, @tree
end
def test_documents
@@ -31,6 +32,7 @@ module Psych
assert_equal [1,1], doc.version
assert_equal [], doc.tag_directives
assert_equal false, doc.implicit
+ assert_location 0, 0, 8, 0, doc
end
def test_sequence
@@ -43,6 +45,7 @@ module Psych
assert_nil seq.tag
assert_equal true, seq.implicit
assert_equal Nodes::Sequence::BLOCK, seq.style
+ assert_location 2, 0, 8, 0, seq
end
def test_scalar
@@ -58,6 +61,7 @@ module Psych
assert_equal true, scalar.plain
assert_equal false, scalar.quoted
assert_equal Nodes::Scalar::PLAIN, scalar.style
+ assert_location 2, 2, 2, 5, scalar
end
def test_mapping
@@ -66,6 +70,7 @@ module Psych
map = seq.children[1]
assert_instance_of Nodes::Mapping, map
+ assert_location 3, 2, 6, 1, map
end
def test_alias
@@ -75,6 +80,15 @@ module Psych
al = seq.children[2]
assert_instance_of Nodes::Alias, al
assert_equal 'A', al.anchor
+ assert_location 7, 2, 7, 4, al
+ end
+
+ private
+ def assert_location(start_line, start_column, end_line, end_column, node)
+ assert_equal start_line, node.start_line
+ assert_equal start_column, node.start_column
+ assert_equal end_line, node.end_line
+ assert_equal end_column, node.end_column
end
end
end