1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package urlenc
- import "testing"
- import "log"
- import "fmt"
- func TestArray(t *testing.T) {
- log.Printf(
- "Array{...}: %s\n",
- Array[int]{
- Name: "id",
- Values: []int{123, 456, 789},
- },
- )
- }
- func TestJoin(t *testing.T) {
- log.Printf(
- "Join(...): %s",
- Join(
- Array[int]{
- "id",
- []int{123, 456, 789},
- },
- Value[string]{"somename", "value with '='"},
- ).Encode(),
- )
- }
- 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],
- ), ""
- },
- },
- )
- }
|