Commit 4dc6120a8e28af474da45501a509f104efe45099

Golmote 2015-08-30T12:45:26

Merge pull request #710 from Golmote/tests-http Add tests for HTTP

diff --git a/tests/languages/http/header-name_feature.test b/tests/languages/http/header-name_feature.test
new file mode 100644
index 0000000..cd2612f
--- /dev/null
+++ b/tests/languages/http/header-name_feature.test
@@ -0,0 +1,24 @@
+Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
+Accept-Encoding: gzip, deflate
+Server: GitHub.com
+Date: Mon, 22 Dec 2014 18:25:30 GMT
+Content-Type: text/html; charset=utf-8
+
+----------------------------------------------------
+
+[
+	["header-name", "Accept-Language:"],
+	" fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3\r\n",
+	["header-name", "Accept-Encoding:"],
+	" gzip, deflate\r\n",
+	["header-name", "Server:"],
+	" GitHub.com\r\n",
+	["header-name", "Date:"],
+	" Mon, 22 Dec 2014 18:25:30 GMT\r\n",
+	["header-name", "Content-Type:"],
+	" text/html; charset=utf-8"
+]
+
+----------------------------------------------------
+
+Checks for header names.
\ No newline at end of file
diff --git a/tests/languages/http/request-line_feature.test b/tests/languages/http/request-line_feature.test
new file mode 100644
index 0000000..e234374
--- /dev/null
+++ b/tests/languages/http/request-line_feature.test
@@ -0,0 +1,51 @@
+POST http://example.com HTTP/1.0
+GET http://localhost:9999/foo.html HTTP/1.1
+PUT http://www.example.com HTTP/2.0
+DELETE https://example.com HTTP/1.1
+OPTIONS https://www.example.com HTTP/1.1
+PATCH http://example.com HTTP/1.0
+TRACE http://example.com HTTP/1.0
+CONNECT http://example.com HTTP/1.0
+
+----------------------------------------------------
+
+[
+	["request-line", [
+		["property", "POST"],
+		" http://example.com HTTP/1.0"
+	]],
+	["request-line", [
+		["property", "GET"],
+		" http://localhost",
+		["attr-name", ":9999"],
+		"/foo.html HTTP/1.1"
+	]],
+	["request-line", [
+		["property", "PUT"],
+		" http://www.example.com HTTP/2.0"
+	]],
+	["request-line", [
+		["property", "DELETE"],
+		" https://example.com HTTP/1.1"
+	]],
+	["request-line", [
+		["property", "OPTIONS"],
+		" https://www.example.com HTTP/1.1"
+	]],
+	["request-line", [
+		["property", "PATCH"],
+		" http://example.com HTTP/1.0"
+	]],
+	["request-line", [
+		["property", "TRACE"],
+		" http://example.com HTTP/1.0"
+	]],
+	["request-line", [
+		["property", "CONNECT"],
+		" http://example.com HTTP/1.0"
+	]]
+]
+
+----------------------------------------------------
+
+Checks for request lines.
\ No newline at end of file
diff --git a/tests/languages/http/response-status_feature.test b/tests/languages/http/response-status_feature.test
new file mode 100644
index 0000000..7384ff2
--- /dev/null
+++ b/tests/languages/http/response-status_feature.test
@@ -0,0 +1,29 @@
+HTTP/1.0 200 OK
+HTTP/1.1 403 Forbidden
+HTTP/1.1 404 Not Found
+HTTP/1.0 418 I'm a teapot
+
+----------------------------------------------------
+
+[
+	["response-status", [
+		"HTTP/1.0 ",
+		["property", "200 OK"]
+	]],
+	["response-status", [
+		"HTTP/1.1 ",
+		["property", "403 Forbidden"]
+	]],
+	["response-status", [
+		"HTTP/1.1 ",
+		["property", "404 Not Found"]
+	]],
+	["response-status", [
+		"HTTP/1.0 ",
+		["property", "418 I'm a teapot"]
+	]]
+]
+
+----------------------------------------------------
+
+Checks for response statuses.
\ No newline at end of file
diff --git a/tests/languages/javascript+http/javascript_inclusion.test b/tests/languages/javascript+http/javascript_inclusion.test
new file mode 100644
index 0000000..825fea4
--- /dev/null
+++ b/tests/languages/javascript+http/javascript_inclusion.test
@@ -0,0 +1,21 @@
+Content-type: application/json
+
+{"foo":"bar"}
+
+----------------------------------------------------
+
+[
+	["header-name", "Content-type:"],
+	" application/json",
+	["application/json", [
+		["punctuation", "{"],
+		["string", "\"foo\""],
+		["punctuation", ":"],
+		["string", "\"bar\""],
+		["punctuation", "}"]
+	]]
+]
+
+----------------------------------------------------
+
+Checks for JSON content in HTTP.
\ No newline at end of file
diff --git a/tests/languages/markup+http/markup_inclusion.test b/tests/languages/markup+http/markup_inclusion.test
new file mode 100644
index 0000000..7745770
--- /dev/null
+++ b/tests/languages/markup+http/markup_inclusion.test
@@ -0,0 +1,30 @@
+Content-type: application/xml
+
+<foo></foo>
+
+----------------------------------------------------
+
+[
+	["header-name", "Content-type:"],
+	" application/xml",
+	["application/xml", [
+		["tag", [
+			["tag", [
+				["punctuation", "<"],
+				"foo"
+			]],
+			["punctuation", ">"]
+		]],
+		["tag", [
+            ["tag", [
+                ["punctuation", "</"],
+                "foo"
+            ]],
+            ["punctuation", ">"]
+        ]]
+	]]
+]
+
+----------------------------------------------------
+
+Checks for XML content in HTTP.
\ No newline at end of file