module html //import net.http fn test_split_parse() { mut parser := Parser{} parser.initialize_all() parser.split_parse(' Hum... ') parser.split_parse('A Tit') parser.split_parse('\nle') parser.split_parse('\t\t\t

') parser.split_parse('Nice Test!

') parser.split_parse('') parser.finalize() assert parser.get_tags().len == 11 assert parser.get_tags()[3].get_content() == ' Hum... A Tit\nle' } fn test_giant_string() { mut temp_html := 'Giant String' for counter := 0; counter < 2000; counter++ { temp_html += "
Look at $counter
" } temp_html += '' mut parser := Parser{} parser.parse_html(temp_html, false) assert parser.get_tags().len == 4009 } fn test_script_tag() { temp_html := "" mut parser := Parser{} parser.parse_html(temp_html, false) assert parser.get_tags()[2].get_content().len == 101 } /*fn test_download_source() { println('Fetching github data in pastebin') resp := http.get('https://pastebin.com/raw/5snUQgqN') or { println('failed to fetch data from the server') return } println('Finalized fetching, start parsing') mut parser := Parser{} parser.parse_html(resp.text, false) assert parser.get_tags().len == 2244 }*/