Files
expr/t_index_test.go
T

31 lines
846 B
Go

// Copyright (c) 2024-2026 Celestino Amoroso (celestino.amoroso@gmail.com).
// All rights reserved.
// t_index_test.go
package expr
import (
"testing"
"git.portale-stac.it/go-pkg/expr/kern"
)
func TestCollections(t *testing.T) {
section := "Index"
inputs := []inputType{
/* 1 */ {`"abcdef"[1:3]`, "bc", nil},
/* 2 */ {`"abcdef"[:3]`, "abc", nil},
/* 3 */ {`"abcdef"[1:]`, "bcdef", nil},
/* 4 */ {`"abcdef"[:]`, "abcdef", nil},
/* 5 */ {`"abcdef"[1:2:3]`, nil, `[1:14] invalid range specification`},
/* 6 */ {`"abcdef"[((1>0)?{1}:{0}):3]`, "bc", nil},
/* 7 */ {`"abcdef"[[0,1][0]:1]`, "a", nil},
/* 8 */ {`[0,1,2,3,4][:]`, kern.NewListA(int64(0), int64(1), int64(2), int64(3), int64(4)), nil},
}
t.Setenv("EXPR_PATH", ".")
// runTestSuiteSpec(t, section, inputs, 5)
runTestSuite(t, section, inputs)
}