Skip to content

Commit

Permalink
Merge pull request #710 from Golmote/tests-http
Browse files Browse the repository at this point in the history
Add tests for HTTP
  • Loading branch information
Golmote committed Aug 30, 2015
2 parents fb7c62a + a67f77d commit 4dc6120
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/languages/http/header-name_feature.test
Original file line number Diff line number Diff line change
@@ -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.
51 changes: 51 additions & 0 deletions tests/languages/http/request-line_feature.test
Original file line number Diff line number Diff line change
@@ -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.
29 changes: 29 additions & 0 deletions tests/languages/http/response-status_feature.test
Original file line number Diff line number Diff line change
@@ -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.
21 changes: 21 additions & 0 deletions tests/languages/javascript+http/javascript_inclusion.test
Original file line number Diff line number Diff line change
@@ -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.
30 changes: 30 additions & 0 deletions tests/languages/markup+http/markup_inclusion.test
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 4dc6120

Please sign in to comment.