2024-05-29 21:55:59 +03:00
|
|
|
package urlenc
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
import "log"
|
2024-07-30 00:43:03 +03:00
|
|
|
import "fmt"
|
2024-05-29 21:55:59 +03:00
|
|
|
|
|
|
|
func TestArray(t *testing.T) {
|
2024-05-30 09:30:25 +03:00
|
|
|
log.Printf(
|
|
|
|
"Array{...}: %s\n",
|
|
|
|
Array[int]{
|
|
|
|
Name: "id",
|
|
|
|
Values: []int{123, 456, 789},
|
|
|
|
},
|
|
|
|
)
|
2024-05-29 21:55:59 +03:00
|
|
|
}
|
2024-05-29 22:59:36 +03:00
|
|
|
|
|
|
|
func TestJoin(t *testing.T) {
|
|
|
|
log.Printf(
|
2024-05-30 09:30:25 +03:00
|
|
|
"Join(...): %s",
|
2024-05-29 22:59:36 +03:00
|
|
|
Join(
|
|
|
|
Array[int]{
|
|
|
|
"id",
|
|
|
|
[]int{123, 456, 789},
|
|
|
|
},
|
2024-05-30 09:30:25 +03:00
|
|
|
Value[string]{"somename", "value with '='"},
|
|
|
|
).Encode(),
|
2024-05-29 22:59:36 +03:00
|
|
|
)
|
|
|
|
}
|
2024-07-30 00:43:03 +03:00
|
|
|
|
|
|
|
func TestFnArray(t *testing.T) {
|
|
|
|
log.Printf(
|
|
|
|
"FnArray{...}: %s",
|
|
|
|
FnArray[int64]{
|
|
|
|
[]int64{
|
|
|
|
1, 2, 3, 11, 12, 13,
|
|
|
|
},
|
|
|
|
func(
|
|
|
|
a []int64, i int,
|
|
|
|
) (string, string) {
|
|
|
|
return fmt.Sprintf(
|
|
|
|
"custom_field_%d_value_changed",
|
|
|
|
a[i],
|
|
|
|
), ""
|
|
|
|
},
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|