@@ -629,6 +629,35 @@ class FOO < RDF::Vocabulary("http://foo/"); end
629629 end
630630 end
631631
632+ describe "reported issues" do
633+ {
634+ "issue #31 no namespaces" => [
635+ %(<http://example.com/> <http://www.w3.org/1999/xhtml/vocab#license> <http://creativecommons.org/licenses/by-sa/3.0/> .) ,
636+ { } ,
637+ {
638+ "/rdf:RDF/rdf:Description/@rdf:about" => 'http://example.com/' ,
639+ "/rdf:RDF/rdf:Description/ns0:license/@rdf:resource" => 'http://creativecommons.org/licenses/by-sa/3.0/'
640+ }
641+ ] ,
642+ "issue #31 with namespaces" => [
643+ %(<http://example.com/> <http://www.w3.org/1999/xhtml/vocab#license> <http://creativecommons.org/licenses/by-sa/3.0/> .) ,
644+ { xhv : 'http://www.w3.org/1999/xhtml/vocab#' } ,
645+ {
646+ "/rdf:RDF/rdf:Description/@rdf:about" => 'http://example.com/' ,
647+ "/rdf:RDF/rdf:Description/xhv:license/@rdf:resource" => 'http://creativecommons.org/licenses/by-sa/3.0/'
648+ }
649+ ]
650+ } . each do |test , ( input , prefixes , paths ) |
651+ it test do
652+ @graph = RDF ::Graph . new << RDF ::Turtle ::Reader . new ( input )
653+ result = serialize ( prefixes : prefixes , standard_prefixes : false )
654+ paths . each do |path , value |
655+ expect ( result ) . to have_xpath ( path , value , { } , @debug )
656+ end
657+ end
658+ end
659+ end
660+
632661 # W3C RDF/XML Test suite from https://dvcs.w3.org/hg/rdf/raw-file/default/rdf-xml/tests/
633662 describe "w3c RDF/XML tests" do
634663 require 'suite_helper'
@@ -669,7 +698,7 @@ def parse(input, options = {})
669698 # Serialize @graph to a string and compare against regexps
670699 def serialize ( options = { } )
671700 @debug = [ ]
672- result = @writer_class . buffer ( { : debug => @debug , : standard_prefixes => true } . merge ( options ) ) do |writer |
701+ result = @writer_class . buffer ( { debug : @debug , standard_prefixes : true } . merge ( options ) ) do |writer |
673702 writer << @graph
674703 end
675704 require 'cgi'
0 commit comments