From 790ad5c8530d1b6f6ad7445c085a7403119c5150 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Sat, 17 Aug 2024 15:54:14 +0900 Subject: [PATCH] test: split duplicated attribute case and namespace conflict case --- test/test_core.rb | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/test/test_core.rb b/test/test_core.rb index e1fba8a7..b079c203 100644 --- a/test/test_core.rb +++ b/test/test_core.rb @@ -114,22 +114,35 @@ def test_attribute name4='test4'/>).join(' '), e.to_s end - def test_attribute_namespace_conflict + def test_attribute_duplicated # https://www.w3.org/TR/xml-names/#uniqAttrs message = <<-MESSAGE.chomp Duplicate attribute "a" -Line: 4 -Position: 140 +Line: 2 +Position: 24 Last 80 unconsumed characters: /> MESSAGE assert_raise(REXML::ParseException.new(message)) do Document.new(<<-XML) + + + + XML + end + end + + def test_attribute_namespace_conflict + # https://www.w3.org/TR/xml-names/#uniqAttrs + message = <<-MESSAGE.chomp +Namespace conflict in adding attribute "a": Prefix "n1" = "http://www.w3.org" and prefix "n2" = "http://www.w3.org" + MESSAGE + assert_raise(REXML::ParseException.new(message)) do + Document.new(<<-XML) - - + xmlns:n2="http://www.w3.org"> + XML end