mirror of
https://github.com/chaisql/chai.git
synced 2025-11-01 11:22:42 +08:00
Drop duration type
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/genjidb/genji/document"
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -34,14 +33,6 @@ func jsonToBoolean(t testing.TB, x string) document.Value {
|
||||
return document.NewBoolValue(b)
|
||||
}
|
||||
|
||||
func jsonToDuration(t testing.TB, x string) document.Value {
|
||||
var d time.Duration
|
||||
err := json.Unmarshal([]byte(x), &d)
|
||||
require.NoError(t, err)
|
||||
|
||||
return document.NewDurationValue(d)
|
||||
}
|
||||
|
||||
func toText(t testing.TB, x string) document.Value {
|
||||
return document.NewTextValue(x)
|
||||
}
|
||||
@@ -127,24 +118,6 @@ func TestCompare(t *testing.T) {
|
||||
{"<=", "1", "2", true, jsonToDouble},
|
||||
{"<=", "2", "2", true, jsonToDouble},
|
||||
|
||||
// duration
|
||||
{"=", "2", "1", false, jsonToDuration},
|
||||
{"=", "2", "2", true, jsonToDuration},
|
||||
{"!=", "2", "1", true, jsonToDuration},
|
||||
{"!=", "2", "2", false, jsonToDuration},
|
||||
{">", "2", "1", true, jsonToDuration},
|
||||
{">", "1", "2", false, jsonToDuration},
|
||||
{">", "2", "2", false, jsonToDuration},
|
||||
{">=", "2", "1", true, jsonToDuration},
|
||||
{">=", "1", "2", false, jsonToDuration},
|
||||
{">=", "2", "2", true, jsonToDuration},
|
||||
{"<", "2", "1", false, jsonToDuration},
|
||||
{"<", "1", "2", true, jsonToDuration},
|
||||
{"<", "2", "2", false, jsonToDuration},
|
||||
{"<=", "2", "1", false, jsonToDuration},
|
||||
{"<=", "1", "2", true, jsonToDuration},
|
||||
{"<=", "2", "2", true, jsonToDuration},
|
||||
|
||||
// text
|
||||
{"=", "b", "a", false, toText},
|
||||
{"=", "b", "b", true, toText},
|
||||
|
||||
Reference in New Issue
Block a user