1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-30 00:07:04 +00:00

add my new trie data structure implementation written from scratch and specifically designed for HTTP (and Iris) - see https://github.com/kataras/muxie for the net/http version of it

Former-commit-id: 4eed1585f29b57418b61f6de058f5d6db4bb98bf
This commit is contained in:
Gerasimos (Makis) Maropoulos
2018-10-15 10:49:09 +03:00
parent 29a4354e1d
commit 3002736086
24 changed files with 575 additions and 648 deletions

View File

@@ -95,7 +95,7 @@ func TestParseParam(t *testing.T) {
}{
{true,
ast.ParamStatement{
Src: "{id:number min(1) max(5) else 404}",
Src: "{id:int min(1) max(5) else 404}",
Name: "id",
Type: mustLookupParamType("number"),
Funcs: []ast.ParamFunc{
@@ -111,6 +111,7 @@ func TestParseParam(t *testing.T) {
{true,
ast.ParamStatement{
// test alias of int.
Src: "{id:number range(1,5)}",
Name: "id",
Type: mustLookupParamType("number"),
@@ -163,7 +164,7 @@ func TestParseParam(t *testing.T) {
}}, // 6
{true,
ast.ParamStatement{
Src: "{id:number even()}", // test param funcs without any arguments (LPAREN peek for RPAREN)
Src: "{id:int even()}", // test param funcs without any arguments (LPAREN peek for RPAREN)
Name: "id",
Type: mustLookupParamType("number"),
Funcs: []ast.ParamFunc{
@@ -236,9 +237,9 @@ func TestParse(t *testing.T) {
valid bool
expectedStatements []ast.ParamStatement
}{
{"/api/users/{id:number min(1) max(5) else 404}", true,
{"/api/users/{id:int min(1) max(5) else 404}", true,
[]ast.ParamStatement{{
Src: "{id:number min(1) max(5) else 404}",
Src: "{id:int min(1) max(5) else 404}",
Name: "id",
Type: paramTypeNumber,
Funcs: []ast.ParamFunc{