summaryrefslogtreecommitdiff
path: root/LibHTML/test.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-15 20:20:55 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-15 20:21:57 +0200
commit581d6b00c828cd6f5920bf7de5b63023d5b52436 (patch)
tree302a408e91d1e6fe4ec606ea4baeaa10354cddce /LibHTML/test.cpp
parenta67e823838943b31fb7cea68bd592093e197cf16 (diff)
downloadserenity-581d6b00c828cd6f5920bf7de5b63023d5b52436.zip
LibHTML: Start working on a very simplified HTML parser.
Diffstat (limited to 'LibHTML/test.cpp')
-rw-r--r--LibHTML/test.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/LibHTML/test.cpp b/LibHTML/test.cpp
index 9d774335c2..ebeda969e6 100644
--- a/LibHTML/test.cpp
+++ b/LibHTML/test.cpp
@@ -1,10 +1,18 @@
+#include <LibCore/CFile.h>
#include <LibHTML/Dump.h>
#include <LibHTML/Element.h>
#include <LibHTML/Parser.h>
+#include <stdio.h>
-int main()
+int main(int argc, char** argv)
{
- String html = "<html><head><title>my page</title></head><body><h1>Hi there</h1><p>Hello World!</p></body></html>";
+ CFile f(argc == 1 ? "/home/anon/small.html" : argv[1]);
+ if (!f.open(CIODevice::ReadOnly)) {
+ fprintf(stderr, "Error: %s\n", f.error_string());
+ return 1;
+ }
+ String html = String::copy(f.read_all());
auto doc = parse(html);
dump_tree(doc);
+ return 0;
}