tests: cleanup test cases (#19104)

This commit is contained in:
shove 2023-08-13 18:36:08 +08:00 committed by GitHub
parent a711e17f41
commit 11a8a46ade
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 131 additions and 184 deletions

View file

@ -2,7 +2,7 @@ module html
fn test_parse() {
doc := parse('<html><body><h1 class="title">Hello world!</h1></body></html>')
tags := doc.get_tag('h1')
tags := doc.get_tags(name: 'h1')
assert tags.len == 1
h1_tag := tags[0] // <h1>Hello world!</h1>
assert h1_tag.name == 'h1'
@ -16,13 +16,13 @@ fn test_parse() {
fn test_parse_inline_tags() {
doc := parse('<html><body><p>before <span>in between</span> after</p></body></html>')
tags := doc.get_tag('span')
tags := doc.get_tags(name: 'span')
assert tags.len == 1
span_tag := tags[0]
assert span_tag.str() == '<span>in between</span>'
p_tags := doc.get_tag('p')
p_tags := doc.get_tags(name: 'p')
assert p_tags.len == 1
p_tag := p_tags[0]