Files
upstream-bleve/mapping/reflect_test.go
upstream-mirror f8d3d9f0cf
Some checks failed
Coverage / coverage (push) Failing after 6s
Tests / test (1.24.x, ubuntu-latest) (push) Failing after 42s
Tests / test (1.26.x, ubuntu-latest) (push) Failing after 38s
Tests / test (1.25.x, ubuntu-latest) (push) Failing after 35s
Tests / test (1.25.x, windows-latest) (push) Has been cancelled
Tests / test (1.26.x, macos-latest) (push) Has been cancelled
Tests / test (1.26.x, windows-latest) (push) Has been cancelled
Tests / test (1.24.x, macos-latest) (push) Has been cancelled
Tests / test (1.24.x, windows-latest) (push) Has been cancelled
Tests / test (1.25.x, macos-latest) (push) Has been cancelled
snapshot of https://github.com/blevesearch/bleve.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:27:16 +05:00

48 lines
742 B
Go

package mapping
import (
"reflect"
"testing"
)
func TestLookupPropertyPath(t *testing.T) {
tests := []struct {
input interface{}
path string
output interface{}
}{
{
input: map[string]interface{}{
"Type": "a",
},
path: "Type",
output: "a",
},
{
input: struct {
Type string
}{
Type: "b",
},
path: "Type",
output: "b",
},
{
input: &struct {
Type string
}{
Type: "b",
},
path: "Type",
output: "b",
},
}
for _, test := range tests {
actual := lookupPropertyPath(test.input, test.path)
if !reflect.DeepEqual(actual, test.output) {
t.Fatalf("expected '%v', got '%v', for path '%s' in %+v", test.output, actual, test.path, test.input)
}
}
}