Skip to content

Commit

Permalink
ast/term_test: Remove "key slice is sorted" test for sets.
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
  • Loading branch information
philipaconrad committed Aug 15, 2022
1 parent 5d18cad commit 879f896
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions ast/term_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"encoding/json"
"fmt"
"reflect"
"sort"
"strings"
"testing"

Expand Down Expand Up @@ -263,37 +262,6 @@ func TestObjectFilter(t *testing.T) {
}
}

func TestSetInsertKeepsKeysSorting(t *testing.T) {
keysSorted := func(s *set) func(int, int) bool {
return func(i, j int) bool {
return Compare(s.keys[i], s.keys[j]) < 0
}
}

s0 := NewSet(
StringTerm("d"),
StringTerm("b"),
StringTerm("a"),
)
s := s0.(*set)
act := sort.SliceIsSorted(s.keys, keysSorted(s))
if exp := true; act != exp {
t.Errorf("SliceIsSorted: expected %v, got %v", exp, act)
for i := range s.keys {
t.Logf("elem[%d]: %v", i, s.keys[i])
}
}

s0.Add(StringTerm("c"))
act = sort.SliceIsSorted(s.keys, keysSorted(s))
if exp := true; act != exp {
t.Errorf("SliceIsSorted: expected %v, got %v", exp, act)
for i := range s.keys {
t.Logf("elem[%d]: %v", i, s.keys[i])
}
}
}

func TestTermBadJSON(t *testing.T) {

input := `{
Expand Down

0 comments on commit 879f896

Please sign in to comment.