refactored data-types to reduce plugin sizes
This commit is contained in:
+19
-19
@@ -8,12 +8,12 @@ import (
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
"git.portale-stac.it/go-pkg/expr/types/array"
|
||||
)
|
||||
|
||||
func TestNewListIterator(t *testing.T) {
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{1, 3, 1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{1, 3, 1})
|
||||
if item, err := it.Next(); err != nil {
|
||||
t.Errorf("error: %v", err)
|
||||
} else if item != "b" {
|
||||
@@ -24,8 +24,8 @@ func TestNewListIterator(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewListIterator2(t *testing.T) {
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{3, 1, -1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{3, 1, -1})
|
||||
if item, err := it.Next(); err != nil {
|
||||
t.Errorf("error: %v", err)
|
||||
} else if item != "d" {
|
||||
@@ -36,8 +36,8 @@ func TestNewListIterator2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNewListIterator3(t *testing.T) {
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{1, -1, 1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{1, -1, 1})
|
||||
if item, err := it.Next(); err != nil {
|
||||
t.Errorf("error: %v", err)
|
||||
} else if item != "b" {
|
||||
@@ -93,8 +93,8 @@ func TestNewIterList5(t *testing.T) {
|
||||
|
||||
func TestNewIterList6(t *testing.T) {
|
||||
ctx := NewSimpleStore()
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it1, _ := NewIterator(ctx, list, nil)
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it1, _ := NewIterator(ctx, a, nil)
|
||||
it, _ := NewIterator(ctx, it1, nil)
|
||||
if item, err := it.Next(); err != nil {
|
||||
t.Errorf("error: %v", err)
|
||||
@@ -115,8 +115,8 @@ func TestNewString(t *testing.T) {
|
||||
|
||||
func TestHasOperation(t *testing.T) {
|
||||
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{1, 3, 1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{1, 3, 1})
|
||||
hasOp := it.HasOperation("reset")
|
||||
if !hasOp {
|
||||
t.Errorf("HasOperation(reset) must be true, got false")
|
||||
@@ -125,8 +125,8 @@ func TestHasOperation(t *testing.T) {
|
||||
|
||||
func TestCallOperationReset(t *testing.T) {
|
||||
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{1, 3, 1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{1, 3, 1})
|
||||
if v, err := it.CallOperation("reset", nil); err != nil {
|
||||
t.Errorf("Error on CallOperation(reset): %v", err)
|
||||
} else {
|
||||
@@ -136,8 +136,8 @@ func TestCallOperationReset(t *testing.T) {
|
||||
|
||||
func TestCallOperationIndex(t *testing.T) {
|
||||
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{1, 3, 1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{1, 3, 1})
|
||||
if v, err := it.CallOperation("index", nil); err != nil {
|
||||
t.Errorf("Error on CallOperation(index): %v", err)
|
||||
} else {
|
||||
@@ -147,8 +147,8 @@ func TestCallOperationIndex(t *testing.T) {
|
||||
|
||||
func TestCallOperationCount(t *testing.T) {
|
||||
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{1, 3, 1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{1, 3, 1})
|
||||
if v, err := it.CallOperation("count", nil); err != nil {
|
||||
t.Errorf("Error on CallOperation(count): %v", err)
|
||||
} else {
|
||||
@@ -158,8 +158,8 @@ func TestCallOperationCount(t *testing.T) {
|
||||
|
||||
func TestCallOperationUnknown(t *testing.T) {
|
||||
|
||||
list := kern.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(list, []any{1, 3, 1})
|
||||
a := array.NewListA("a", "b", "c", "d")
|
||||
it := NewListIterator(a, []any{1, 3, 1})
|
||||
if v, err := it.CallOperation("unknown", nil); err == nil {
|
||||
t.Errorf("Expected error on CallOperation(unknown), got %v", v)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user