Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds a test case #24561

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions tests/refc/t18616.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
discard """
matrix: "--mm:refc; --mm:arc"
joinable: false
"""

import std/[unittest, asyncdispatch]

# bug #18616
type
ClientResponse = object
status*: int
data*: string

template asyncTest*(name: string, body: untyped): untyped =
test name:
waitFor((
proc() {.async, gcsafe.} =
body
)())

suite "Test suite":
asyncTest "test1":
const PostVectors = [
(
("/test/post", "somebody0908", "text/html",
"app/type1;q=0.9,app/type2;q=0.8"),
ClientResponse(status: 200, data: "type1[text/html,somebody0908]")
),
(
("/test/post", "somebody0908", "text/html",
"app/type2;q=0.8,app/type1;q=0.9"),
ClientResponse(status: 200, data: "type1[text/html,somebody0908]")
),
(
("/test/post", "somebody09", "text/html",
"app/type2,app/type1;q=0.9"),
ClientResponse(status: 200, data: "type2[text/html,somebody09]")
),
(
("/test/post", "somebody09", "text/html", "app/type1;q=0.9,app/type2"),
ClientResponse(status: 200, data: "type2[text/html,somebody09]")
),
(
("/test/post", "somebody", "text/html", "*/*"),
ClientResponse(status: 200, data: "type1[text/html,somebody]")
),
(
("/test/post", "somebody", "text/html", ""),
ClientResponse(status: 200, data: "type1[text/html,somebody]")
),
(
("/test/post", "somebody", "text/html", "app/type2"),
ClientResponse(status: 200, data: "type2[text/html,somebody]")
),
(
("/test/post", "somebody", "text/html", "app/type3"),
ClientResponse(status: 406, data: "")
)
]

for item in PostVectors:
discard item

asyncTest "test2":
const PostVectors = [
(
"/test/post", "somebody0908", "text/html",
"app/type1;q=0.9,app/type2;q=0.8",
ClientResponse(status: 200, data: "type1[text/html,somebody0908]")
),
(
"/test/post", "somebody0908", "text/html",
"app/type2;q=0.8,app/type1;q=0.9",
ClientResponse(status: 200, data: "type1[text/html,somebody0908]")
),
(
"/test/post", "somebody09", "text/html",
"app/type2,app/type1;q=0.9",
ClientResponse(status: 200, data: "type2[text/html,somebody09]")
),
(
"/test/post", "somebody09", "text/html", "app/type1;q=0.9,app/type2",
ClientResponse(status: 200, data: "type2[text/html,somebody09]")
),
(
"/test/post", "somebody", "text/html", "*/*",
ClientResponse(status: 200, data: "type1[text/html,somebody]")
),
(
"/test/post", "somebody", "text/html", "",
ClientResponse(status: 200, data: "type1[text/html,somebody]")
),
(
"/test/post", "somebody", "text/html", "app/type2",
ClientResponse(status: 200, data: "type2[text/html,somebody]")
),
(
"/test/post", "somebody", "text/html", "app/type3",
ClientResponse(status: 406, data: "")
)
]

for item in PostVectors:
discard item
2 changes: 1 addition & 1 deletion tests/refc/tsinkbug.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
discard """
matrix: "--gc:refc; --gc:arc"
matrix: "--mm:refc; --mm:arc"
output: '''
Value is: 42
Value is: 42'''
Expand Down