Packages

A module to decode HTML into a tree, porting all properties of the underlying library myhtml, being fast and correct in regards to the html spec.

Current section

Files

Jump to
myhtmlex test myhtmlex.nif_test.exs
Raw

test/myhtmlex.nif_test.exs

defmodule Myhtmlex.NifTest do
use MyhtmlexSharedTests, module: Myhtmlex.Nif
test "parse a larger file (131K)" do
html = File.read!("bench/github_trending_js.html")
ref = Myhtmlex.open(html)
assert is_reference(ref)
assert is_tuple(Myhtmlex.decode_tree(ref))
end
test "open" do
ref = Myhtmlex.open(~s'<dif class="a"></div><div class="b"></div>')
assert is_reference(ref)
end
test "open and decode_tree" do
ref = Myhtmlex.open(~s'text node')
assert is_reference(ref)
assert {:html, [], [
{:head, [], []},
{:body, [], [
"text node"
]}
]} = Myhtmlex.decode_tree(ref, format: [:html_atoms])
end
end