From 095524152564f863a016c137d17efc785fc7c6a1 Mon Sep 17 00:00:00 2001 From: "Daniel G. Taylor" Date: Tue, 2 Oct 2018 12:31:01 -0700 Subject: [PATCH] Add HTTP unit test --- lexers/testdata/http.actual | 5 +++++ lexers/testdata/http.expected | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 lexers/testdata/http.actual create mode 100644 lexers/testdata/http.expected diff --git a/lexers/testdata/http.actual b/lexers/testdata/http.actual new file mode 100644 index 0000000..aadc007 --- /dev/null +++ b/lexers/testdata/http.actual @@ -0,0 +1,5 @@ +GET /foo HTTP/1.1 +Content-Type: application/json +User-Agent: foo + +{"hello": "world"} diff --git a/lexers/testdata/http.expected b/lexers/testdata/http.expected new file mode 100644 index 0000000..82fb269 --- /dev/null +++ b/lexers/testdata/http.expected @@ -0,0 +1,27 @@ +[ + {"type":"NameFunction","value":"GET"}, + {"type":"Text","value":" "}, + {"type":"NameNamespace","value":"/foo"}, + {"type":"Text","value":" "}, + {"type":"KeywordReserved","value":"HTTP"}, + {"type":"Operator","value":"/"}, + {"type":"LiteralNumber","value":"1.1"}, + {"type":"Text","value":"\n"}, + {"type":"Name","value":"Content-Type"}, + {"type":"Operator","value":":"}, + {"type":"Text","value":" "}, + {"type":"Literal","value":"application/json"}, + {"type":"Text","value":"\n"}, + {"type":"Name","value":"User-Agent"}, + {"type":"Operator","value":":"}, + {"type":"Text","value":" "}, + {"type":"Literal","value":"foo"}, + {"type":"Text","value":"\n\n"}, + {"type":"Punctuation","value":"{"}, + {"type":"NameTag","value":"\"hello\""}, + {"type":"Punctuation","value":":"}, + {"type":"Text","value":" "}, + {"type":"LiteralStringDouble","value":"\"world\""}, + {"type":"Punctuation","value":"}"}, + {"type":"Text","value":"\n"} +]