Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
package macro
|
|
|
|
|
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Most important tests to look:
|
|
|
|
// ../parser/parser_test.go
|
|
|
|
// ../lexer/lexer_test.go
|
|
|
|
|
|
|
|
func TestGoodParamFunc(t *testing.T) {
|
|
|
|
good1 := func(min int, max int) func(string) bool {
|
|
|
|
return func(paramValue string) bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 16:29:39 +02:00
|
|
|
good2 := func(min uint64, max uint64) func(string) bool {
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
return func(paramValue string) bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
notgood1 := func(min int, max int) bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if !goodParamFunc(reflect.TypeOf(good1)) {
|
|
|
|
t.Fatalf("expected good1 func to be good but it's not")
|
|
|
|
}
|
|
|
|
|
|
|
|
if !goodParamFunc(reflect.TypeOf(good2)) {
|
|
|
|
t.Fatalf("expected good2 func to be good but it's not")
|
|
|
|
}
|
|
|
|
|
|
|
|
if goodParamFunc(reflect.TypeOf(notgood1)) {
|
|
|
|
t.Fatalf("expected notgood1 func to be the worst")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestGoodParamFuncName(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
name string
|
|
|
|
good bool
|
|
|
|
}{
|
|
|
|
{"range", true},
|
|
|
|
{"_range", true},
|
|
|
|
{"range_", true},
|
|
|
|
{"r_ange", true},
|
|
|
|
// numbers or other symbols are invalid.
|
|
|
|
{"range1", false},
|
|
|
|
{"2range", false},
|
|
|
|
{"r@nge", false},
|
|
|
|
{"rang3", false},
|
|
|
|
}
|
|
|
|
for i, tt := range tests {
|
|
|
|
isGood := goodParamFuncName(tt.name)
|
|
|
|
if tt.good && !isGood {
|
|
|
|
t.Fatalf("tests[%d] - expecting valid name but got invalid for name %s", i, tt.name)
|
|
|
|
} else if !tt.good && isGood {
|
|
|
|
t.Fatalf("tests[%d] - expecting invalid name but got valid for name %s", i, tt.name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 05:30:12 +02:00
|
|
|
func testEvaluatorRaw(t *testing.T, macroEvaluator *Macro, input string, pass bool, i int) {
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
if got := macroEvaluator.Evaluator(input); pass != got {
|
2018-08-23 05:30:12 +02:00
|
|
|
t.Fatalf("%s - tests[%d] - expecting %v but got %v", t.Name(), i, pass, got)
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestStringEvaluatorRaw(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
|
|
|
{true, "astring"}, // 0
|
|
|
|
{true, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{true, "32321"}, // 2
|
|
|
|
{true, "main.css"}, // 3
|
|
|
|
{true, "/assets/main.css"}, // 4
|
|
|
|
// false never
|
|
|
|
} // 0
|
|
|
|
|
|
|
|
for i, tt := range tests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, String, tt.input, tt.pass, i)
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 05:30:12 +02:00
|
|
|
func TestNumberEvaluatorRaw(t *testing.T) {
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
tests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
2018-08-23 05:30:12 +02:00
|
|
|
{false, "astring"}, // 0
|
|
|
|
{false, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{true, "32321"}, // 2
|
|
|
|
{true, "18446744073709551615"}, // 3
|
|
|
|
{true, "-18446744073709551615"}, // 4
|
|
|
|
{true, "-18446744073709553213213213213213121615"}, // 5
|
|
|
|
{false, "42 18446744073709551615"}, // 6
|
|
|
|
{false, "--42"}, // 7
|
2018-08-31 01:09:48 +02:00
|
|
|
{false, "+42"}, // 8
|
2018-08-23 05:30:12 +02:00
|
|
|
{false, "main.css"}, // 9
|
|
|
|
{false, "/assets/main.css"}, // 10
|
|
|
|
}
|
|
|
|
|
|
|
|
for i, tt := range tests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, Number, tt.input, tt.pass, i)
|
2018-08-23 05:30:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestInt64EvaluatorRaw(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
|
|
|
{false, "astring"}, // 0
|
|
|
|
{false, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{false, "18446744073709551615"}, // 2
|
|
|
|
{false, "92233720368547758079223372036854775807"}, // 3
|
|
|
|
{false, "9223372036854775808 9223372036854775808"}, // 4
|
|
|
|
{false, "main.css"}, // 5
|
|
|
|
{false, "/assets/main.css"}, // 6
|
|
|
|
{true, "9223372036854775807"}, // 7
|
|
|
|
{true, "-9223372036854775808"}, // 8
|
|
|
|
{true, "-0"}, // 9
|
|
|
|
{true, "1"}, // 10
|
|
|
|
{true, "-042"}, // 11
|
|
|
|
{true, "142"}, // 12
|
|
|
|
}
|
|
|
|
|
|
|
|
for i, tt := range tests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, Int64, tt.input, tt.pass, i)
|
2018-08-23 05:30:12 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 23:56:54 +02:00
|
|
|
func TestUint8EvaluatorRaw(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
|
|
|
{false, "astring"}, // 0
|
|
|
|
{false, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{false, "-9223372036854775808"}, // 2
|
|
|
|
{false, "main.css"}, // 3
|
|
|
|
{false, "/assets/main.css"}, // 4
|
|
|
|
{false, "92233720368547758079223372036854775807"}, // 5
|
|
|
|
{false, "9223372036854775808 9223372036854775808"}, // 6
|
|
|
|
{false, "-1"}, // 7
|
|
|
|
{false, "-0"}, // 8
|
|
|
|
{false, "+1"}, // 9
|
|
|
|
{false, "18446744073709551615"}, // 10
|
|
|
|
{false, "9223372036854775807"}, // 11
|
|
|
|
{false, "021"}, // 12 - no leading zeroes are allowed.
|
|
|
|
{false, "300"}, // 13
|
|
|
|
{true, "0"}, // 14
|
|
|
|
{true, "255"}, // 15
|
|
|
|
{true, "21"}, // 16
|
|
|
|
}
|
|
|
|
|
|
|
|
for i, tt := range tests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, Uint8, tt.input, tt.pass, i)
|
2018-08-23 23:56:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 05:30:12 +02:00
|
|
|
func TestUint64EvaluatorRaw(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
|
|
|
{false, "astring"}, // 0
|
|
|
|
{false, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{false, "-9223372036854775808"}, // 2
|
|
|
|
{false, "main.css"}, // 3
|
|
|
|
{false, "/assets/main.css"}, // 4
|
|
|
|
{false, "92233720368547758079223372036854775807"}, // 5
|
|
|
|
{false, "9223372036854775808 9223372036854775808"}, // 6
|
|
|
|
{false, "-1"}, // 7
|
|
|
|
{false, "-0"}, // 8
|
|
|
|
{false, "+1"}, // 9
|
|
|
|
{true, "18446744073709551615"}, // 10
|
|
|
|
{true, "9223372036854775807"}, // 11
|
|
|
|
{true, "0"}, // 12
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for i, tt := range tests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, Uint64, tt.input, tt.pass, i)
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestAlphabeticalEvaluatorRaw(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
|
|
|
{true, "astring"}, // 0
|
|
|
|
{false, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{false, "32321"}, // 2
|
|
|
|
{false, "main.css"}, // 3
|
|
|
|
{false, "/assets/main.css"}, // 4
|
|
|
|
}
|
|
|
|
|
|
|
|
for i, tt := range tests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, Alphabetical, tt.input, tt.pass, i)
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFileEvaluatorRaw(t *testing.T) {
|
|
|
|
tests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
|
|
|
{true, "astring"}, // 0
|
|
|
|
{false, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{true, "32321"}, // 2
|
|
|
|
{true, "main.css"}, // 3
|
|
|
|
{false, "/assets/main.css"}, // 4
|
|
|
|
}
|
|
|
|
|
|
|
|
for i, tt := range tests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, File, tt.input, tt.pass, i)
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestPathEvaluatorRaw(t *testing.T) {
|
|
|
|
pathTests := []struct {
|
|
|
|
pass bool
|
|
|
|
input string
|
|
|
|
}{
|
|
|
|
{true, "astring"}, // 0
|
|
|
|
{true, "astringwith_numb3rS_and_symbol$"}, // 1
|
|
|
|
{true, "32321"}, // 2
|
|
|
|
{true, "main.css"}, // 3
|
|
|
|
{true, "/assets/main.css"}, // 4
|
|
|
|
{true, "disk/assets/main.css"}, // 5
|
|
|
|
}
|
|
|
|
|
|
|
|
for i, tt := range pathTests {
|
2018-09-26 10:37:11 +02:00
|
|
|
testEvaluatorRaw(t, Path, tt.input, tt.pass, i)
|
Publish the new version :airplane: | Look description please!
# FAQ
### Looking for free support?
http://support.iris-go.com
https://kataras.rocket.chat/channel/iris
### Looking for previous versions?
https://github.com/kataras/iris#version
### Should I upgrade my Iris?
Developers are not forced to upgrade if they don't really need it. Upgrade whenever you feel ready.
> Iris uses the [vendor directory](https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG9AFL0JAYo) feature, so you get truly reproducible builds, as this method guards against upstream renames and deletes.
**How to upgrade**: Open your command-line and execute this command: `go get -u github.com/kataras/iris`.
For further installation support, please click [here](http://support.iris-go.com/d/16-how-to-install-iris-web-framework).
### About our new home page
http://iris-go.com
Thanks to [Santosh Anand](https://github.com/santoshanand) the http://iris-go.com has been upgraded and it's really awesome!
[Santosh](https://github.com/santoshanand) is a freelancer, he has a great knowledge of nodejs and express js, Android, iOS, React Native, Vue.js etc, if you need a developer to find or create a solution for your problem or task, please contact with him.
The amount of the next two or three donations you'll send they will be immediately transferred to his own account balance, so be generous please!
Read more at https://github.com/kataras/iris/blob/master/HISTORY.md
Former-commit-id: eec2d71bbe011d6b48d2526eb25919e36e5ad94e
2017-06-03 22:22:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 16:29:39 +02:00
|
|
|
func TestConvertBuilderFunc(t *testing.T) {
|
|
|
|
fn := func(min uint64, slice []string) func(string) bool {
|
|
|
|
return func(paramValue string) bool {
|
|
|
|
if expected, got := "ok", paramValue; expected != got {
|
|
|
|
t.Fatalf("paramValue is not the expected one: %s vs %s", expected, got)
|
|
|
|
}
|
|
|
|
|
|
|
|
if expected, got := uint64(1), min; expected != got {
|
|
|
|
t.Fatalf("min argument is not the expected one: %d vs %d", expected, got)
|
|
|
|
}
|
|
|
|
|
|
|
|
if expected, got := []string{"name1", "name2"}, slice; len(expected) == len(got) {
|
|
|
|
if expected, got := "name1", slice[0]; expected != got {
|
|
|
|
t.Fatalf("slice argument[%d] does not contain the expected value: %s vs %s", 0, expected, got)
|
|
|
|
}
|
|
|
|
|
|
|
|
if expected, got := "name2", slice[1]; expected != got {
|
|
|
|
t.Fatalf("slice argument[%d] does not contain the expected value: %s vs %s", 1, expected, got)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
t.Fatalf("slice argument is not the expected one, the length is difference: %d vs %d", len(expected), len(got))
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
evalFunc := convertBuilderFunc(fn)
|
|
|
|
|
|
|
|
if !evalFunc([]string{"1", "[name1,name2]"})("ok") {
|
|
|
|
t.Fatalf("failed, it should fail already")
|
|
|
|
}
|
|
|
|
}
|