You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
904 B
Lua
46 lines
904 B
Lua
before_each(function()
|
|
lor = _G.lor
|
|
app = lor({
|
|
debug = false
|
|
})
|
|
Request = _G.request
|
|
Response = _G.response
|
|
req = Request:new()
|
|
res = Response:new()
|
|
|
|
flag = 0
|
|
end)
|
|
|
|
after_each(function()
|
|
lor = nil
|
|
app = nil
|
|
Request = nil
|
|
Response = nil
|
|
req = nil
|
|
res = nil
|
|
match = nil
|
|
end)
|
|
|
|
describe("uri should support `-`", function()
|
|
it("test case 1", function()
|
|
req.path = "/a-b-c"
|
|
req.method = "get"
|
|
app:get("/a-b-c", function(req, res, next)
|
|
flag = 1
|
|
end)
|
|
app:handle(req, res)
|
|
assert.is.equals(1, flag)
|
|
end)
|
|
|
|
it("test case 2", function()
|
|
req.path = "/a_-b-/cde/-f"
|
|
req.method = "get"
|
|
app:get("/a_-b-/cde/-f", function(req, res, next)
|
|
flag = 2
|
|
end)
|
|
app:handle(req, res)
|
|
assert.is.equals(2, flag)
|
|
end)
|
|
|
|
end)
|