return data[index * 5 + 3]
end
else if index isa String and "" != index then
- var i: Int = 0
+ var i = 0
while i < data.length do
if data[i + 2] == index then
return data[index * 5 + 4]
end
else if index isa String and "" != index then
- var i: Int = 0
+ var i = 0
while i < data.length do
if data[i + 2] == index then
# The index of the attribute, or -1 if it does not
# appear in the list.
redef fun index_ns(uri: String, local_name: String): Int do
- var i: Int = 0
+ var i = 0
if "" != local_name then
while i < data.length do
# The index of the attribute, or -1 if it does not
# appear in the list.
redef fun index_of(qname: String): Int do
- var i: Int = 0
+ var i = 0
if "" != qname then
while i < data.length do
# attribute is not in the list or if Namespace
# processing is not being performed.
redef fun type_ns(uri: String, local_name: String): nullable String do
- var i: Int = 0
+ var i = 0
if "" != local_name then
while i < data.length do
# attribute is not in the list or if Namespace
# processing is not being performed.
redef fun value_ns(uri: String, local_name: String): nullable String do
- var i: Int = 0
+ var i = 0
if "" != local_name then
while i < data.length do
#
# * `atts`: attributes to copy.
fun attributes=(atts: Attributes) do
- var i: Int = 0
+ var i = 0
clear
length = atts.length
super TestSuite
private fun sample: AttributesImpl do
- var subject: AttributesImpl = new AttributesImpl
+ var subject = new AttributesImpl
# The parser may include everything...
subject.add("http://example.com/", "bar", "foo:bar", "CDATA", "baz")
end
fun test_length do
- var subject: AttributesImpl = new AttributesImpl
+ var subject = new AttributesImpl
assert 0 == subject.length
subject.add("http://example.com/", "bar", "foo:bar", "CDATA", "baz")
end
fun test_uri do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "http://example.com/" == subject.uri(0)
assert "urn:is:not:often:used" == subject.uri(1)
end
fun test_local_name do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "bar" == subject.local_name(0)
assert "i-am_ME" == subject.local_name(1)
end
fun test_qname do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "foo:bar" == subject.qname(0)
assert "" == subject.qname(1)
end
fun test_type_of do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "CDATA" == subject.type_of(0)
assert "ID" == subject.type_of(1)
end
fun test_type_of_qname do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "CDATA" == subject.type_of("foo:bar")
assert subject.type_of("") == null
end
fun test_value_of do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "baz" == subject.value_of(0)
assert "noop" == subject.value_of(1)
end
fun test_value_of_qname do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "baz" == subject.value_of("foo:bar")
assert subject.value_of("") == null
end
fun test_index_ns do
- var subject: AttributesImpl = sample
+ var subject = sample
assert 0 == subject.index_ns("http://example.com/", "bar")
assert 1 == subject.index_ns("urn:is:not:often:used", "i-am_ME")
end
fun test_index_of do
- var subject: AttributesImpl = sample
+ var subject = sample
assert 0 == subject.index_of("foo:bar")
assert -1 == subject.index_of("")
end
fun test_type_ns do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "CDATA" == subject.type_ns("http://example.com/", "bar")
assert "ID" == subject.type_ns("urn:is:not:often:used", "i-am_ME")
end
fun test_value_ns do
- var subject: AttributesImpl = sample
+ var subject = sample
assert "baz" == subject.value_ns("http://example.com/", "bar")
assert "noop" == subject.value_ns("urn:is:not:often:used", "i-am_ME")
end
fun test_attributes_set do
- var subject: AttributesImpl = sample
- var subject2: AttributesImpl = new AttributesImpl
+ var subject = sample
+ var subject2 = new AttributesImpl
subject.attributes = subject2
assert subject.length == 0
end
fun test_set do
- var subject: AttributesImpl = sample
+ var subject = sample
subject.set(1, "urn:is:not:often:used", "i-am_ME", "i-am_ME", "ID",
"noop")
end
fun test_remove_at do
- var subject: AttributesImpl = sample
+ var subject = sample
subject.remove_at(1)
assert 3 == subject.length
end
fun test_uri_set do
- var subject: AttributesImpl = sample
+ var subject = sample
subject.uri(0) = "https://example.org/serious"
subject.uri(1) = "ftp://wat"
end
fun test_local_name_set do
- var subject: AttributesImpl = sample
+ var subject = sample
subject.local_name(0) = "trololol"
subject.local_name(1) = "ImYou42"
end
fun test_qname_set do
- var subject: AttributesImpl = sample
+ var subject = sample
subject.qname(0) = "go-to:bar"
subject.qname(1) = "yo:i-am_ME"
end
fun test_type_of_set do
- var subject: AttributesImpl = sample
+ var subject = sample
subject.type_of(0) = "NMTOKENS"
subject.type_of(1) = "ENTITY"
end
fun test_value_of_set do
- var subject: AttributesImpl = sample
+ var subject = sample
subject.value_of(0) = "buz"
subject.value_of(1) = "bizzz"