Merge pull request #710 from Golmote/tests-http Add tests for HTTP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
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