Sha256: d02c20b0b0e03ebad60016c2c2d442a17413744d71a375854d7c12b551e20e1e
Contents?: true
Size: 922 Bytes
Versions: 11
Compression:
Stored size: 922 Bytes
Contents
require File.expand_path(::File.dirname(__FILE__) + '/../lib/xml/smart') require File.expand_path(::File.dirname(__FILE__) + '/smartrunner.rb') class TestRelaxng < Minitest::Test def test_relaxng doc = XML::Smart.open(::File.dirname(__FILE__) + "/HELLO.xml") doc.xinclude! xsd = XML::Smart.open(::File.dirname(__FILE__) + "/HELLO.rng") nums = 10000 # Watch the power Minitest::PerformanceReporter::start_timing "RelaxNG #validate_against (#{nums} times)" nums.times do doc.validate_against(xsd) end assert(doc.validate_against(xsd) == true) Minitest::PerformanceReporter::end_timing doc.find('/hellos/hello[3]').each do |h| h.qname.name = 'test' end assert(!doc.validate_against(xsd)) doc.validate_against(xsd) do |err| assert("#{err.file} line #{err.line}: #{err.to_s}" =~ /HELLO.xml .* Did not expect element test there/) end end end
Version data entries
11 entries across 11 versions & 1 rubygems