moved a subset of source file to the kern package

This commit is contained in:
2026-04-27 19:43:37 +02:00
parent f100adead3
commit 4d910dd069
107 changed files with 2080 additions and 1380 deletions
+12 -9
View File
@@ -7,10 +7,12 @@ package expr
import (
"io"
"testing"
"git.portale-stac.it/go-pkg/expr/kern"
)
func TestNewListIterator(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{1, 3, 1})
if item, err := it.Next(); err != nil {
t.Errorf("error: %v", err)
@@ -22,7 +24,7 @@ func TestNewListIterator(t *testing.T) {
}
func TestNewListIterator2(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{3, 1, -1})
if item, err := it.Next(); err != nil {
t.Errorf("error: %v", err)
@@ -34,7 +36,7 @@ func TestNewListIterator2(t *testing.T) {
}
func TestNewListIterator3(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{1, -1, 1})
if item, err := it.Next(); err != nil {
t.Errorf("error: %v", err)
@@ -90,7 +92,7 @@ func TestNewIterList5(t *testing.T) {
}
func TestNewIterList6(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it1, _ := NewIterator(list)
it, _ := NewIterator(it1)
if item, err := it.Next(); err != nil {
@@ -101,6 +103,7 @@ func TestNewIterList6(t *testing.T) {
t.Logf("Next: %v", item)
}
}
func TestNewString(t *testing.T) {
list := "123"
it, _ := NewIterator(list)
@@ -111,7 +114,7 @@ func TestNewString(t *testing.T) {
func TestHasOperation(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{1, 3, 1})
hasOp := it.HasOperation("reset")
if !hasOp {
@@ -121,7 +124,7 @@ func TestHasOperation(t *testing.T) {
func TestCallOperationReset(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{1, 3, 1})
if v, err := it.CallOperation("reset", nil); err != nil {
t.Errorf("Error on CallOperation(reset): %v", err)
@@ -132,7 +135,7 @@ func TestCallOperationReset(t *testing.T) {
func TestCallOperationIndex(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{1, 3, 1})
if v, err := it.CallOperation("index", nil); err != nil {
t.Errorf("Error on CallOperation(index): %v", err)
@@ -143,7 +146,7 @@ func TestCallOperationIndex(t *testing.T) {
func TestCallOperationCount(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{1, 3, 1})
if v, err := it.CallOperation("count", nil); err != nil {
t.Errorf("Error on CallOperation(count): %v", err)
@@ -154,7 +157,7 @@ func TestCallOperationCount(t *testing.T) {
func TestCallOperationUnknown(t *testing.T) {
list := newListA("a", "b", "c", "d")
list := kern.NewListA("a", "b", "c", "d")
it := NewListIterator(list, []any{1, 3, 1})
if v, err := it.CallOperation("unknown", nil); err == nil {
t.Errorf("Expected error on CallOperation(unknown), got %v", v)