# another product.
# Test suite for `namespace_support`.
-module test_namespace_support is test_suite
+module test_namespace_support is test
-import test_suite
import sax::helpers::namespace_support
class TestNamespaceSupport
- super TestSuite
+ test
private fun sample: NamespaceSupport do
var subject = new NamespaceSupport
return subject
end
- fun test_reset do
+ fun test_reset is test do
var subject = sample
subject.reset
assert 2 == subject.prefixes.length
end
- fun test_push_context_override_default do
+ fun test_push_context_override_default is test do
var subject = sample
subject.push_context
assert 3 == subject.prefixes.length
end
- fun test_push_context_override_dc do
+ fun test_push_context_override_dc is test do
var subject = sample
subject.push_context
assert 3 == subject.prefixes.length
end
- fun test_push_context_undeclare do
+ fun test_push_context_undeclare is test do
var subject = sample
subject.push_context
assert 2 == subject.prefixes.length
end
- fun test_pop_context do
+ fun test_pop_context is test do
var subject = sample
subject.pop_context
#fun test_declare_prefix # SEE: test_push_context_*
- fun test_process_name do
+ fun test_process_name is test do
var subject = sample
var parts = new Array[String]
assert ["", "p", "p"] == subject.process_name("p", parts, true)
end
- fun test_process_name_xmlns do
+ fun test_process_name_xmlns is test do
var subject = sample
var parts = new Array[String].with_capacity(3)
assert ["http://www.w3.org/1999/xhtml", "xmlns", "xmlns"] == subject.process_name("xmlns", parts, false)
end
- fun test_declare_prefix_illegal do
+ fun test_declare_prefix_illegal is test do
var subject = sample
assert not subject.declare_prefix("xml", "http://example.org")
assert 2 == subject.declared_prefixes.length
end
- fun test_uri do
+ fun test_uri is test do
var subject = sample
assert "http://www.w3.org/1999/xhtml" == subject.uri("")
assert subject.uri("foo") == null
end
- fun test_prefixes do
- var subject = sample
+ fun test_prefixes is test do
var res = sample.prefixes
assert 3 == res.length else
assert res.has("xmlns")
end
- fun test_prefix do
+ fun test_prefix is test do
var subject = sample
assert subject.prefix("http://www.w3.org/1999/xhtml") == null
assert subject.prefix("https://example.org/serious") == null
end
- fun test_prefixes_of do
+ fun test_prefixes_of is test do
var subject = sample
var res: Collection[String]
assert res.has_all(["dc", "dc2"])
end
- fun test_declared_prefixes do
- var subject = sample
+ fun test_declared_prefixes is test do
var res = sample.declared_prefixes
assert 2 == res.length else