Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jan 23, 2025
1 parent ee66c72 commit 5d10638
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions vlib/v/tests/printing/print_option_ref_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import net.html

fn test_nil() {
mut doc := html.parse('<body><div class="Box-footer"><div class="truncate">abc</div></div></body>')
footer := doc.get_tags_by_class_name('Box-footer')[0]
hrefs := footer.get_tag_by_class_name('Truncate')
println(hrefs)
res := '${hrefs}'
assert res == '&Option(&nil)'
}

fn test_non_nil() {
mut doc := html.parse('<body><div class="Box-footer"><div class="Truncate">abc</div></div></body>')
footer := doc.get_tags_by_class_name('Box-footer')[0]
hrefs := footer.get_tag_by_class_name('Truncate')
println(hrefs)
res := '${hrefs}'
assert res == '&Option(<div class="Truncate" >abc</div>)'
}

0 comments on commit 5d10638

Please sign in to comment.