mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-20 06:31:32 +03:00
44d27207f8
* Column-only queries
29 lines
571 B
Go
29 lines
571 B
Go
package loz_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/neilotoole/sq/libsq/core/loz"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestAll(t *testing.T) {
|
|
gotAny := loz.All[any]()
|
|
require.Equal(t, []any{}, gotAny)
|
|
|
|
gotStrings := loz.All("hello", "world")
|
|
require.Equal(t, []string{"hello", "world"}, gotStrings)
|
|
}
|
|
|
|
func TestToSliceType(t *testing.T) {
|
|
input1 := []any{"hello", "world"}
|
|
|
|
var got []string
|
|
var ok bool
|
|
|
|
got, ok = loz.ToSliceType[any, string](input1...)
|
|
require.True(t, ok)
|
|
require.Len(t, got, 2)
|
|
require.Equal(t, []string{"hello", "world"}, got)
|
|
}
|