diff --git a/examples/xpath.fql b/examples/xpath.fql new file mode 100644 index 00000000..b57888b7 --- /dev/null +++ b/examples/xpath.fql @@ -0,0 +1,5 @@ +LET doc = DOCUMENT("https://www.google.ca", { + driver: 'cdp' +}) + +RETURN XPATH(doc, "//meta/@charset") // ["UTF-8"] \ No newline at end of file diff --git a/go.mod b/go.mod index 6fd3268c..6fa39e5a 100644 --- a/go.mod +++ b/go.mod @@ -4,20 +4,20 @@ go 1.17 require ( github.com/PuerkitoBio/goquery v1.8.0 - github.com/antchfx/htmlquery v1.2.4 - github.com/antchfx/xpath v1.2.0 + github.com/antchfx/htmlquery v1.2.5 + github.com/antchfx/xpath v1.2.1 github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211211185417-43fb4c2dbe28 github.com/corpix/uarand v0.1.1 github.com/gobwas/glob v0.2.3 github.com/gorilla/css v1.0.0 - github.com/jarcoal/httpmock v1.1.0 + github.com/jarcoal/httpmock v1.2.0 github.com/mafredri/cdp v0.32.0 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.26.1 github.com/sethgrid/pester v1.1.0 github.com/smartystreets/goconvey v1.7.2 github.com/stretchr/testify v1.7.0 - github.com/wI2L/jettison v0.7.3 + github.com/wI2L/jettison v0.7.4 golang.org/x/net v0.0.0-20211209124913-491a49abca63 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/text v0.3.7 diff --git a/go.sum b/go.sum index 603ff741..92de4849 100644 --- a/go.sum +++ b/go.sum @@ -5,10 +5,10 @@ github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0g github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI= github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c= github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA= -github.com/antchfx/htmlquery v1.2.4 h1:qLteofCMe/KGovBI6SQgmou2QNyedFUW+pE+BpeZ494= -github.com/antchfx/htmlquery v1.2.4/go.mod h1:2xO6iu3EVWs7R2JYqBbp8YzG50gj/ofqs5/0VZoDZLc= -github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8= -github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= +github.com/antchfx/htmlquery v1.2.5 h1:1lXnx46/1wtv1E/kzmH8vrfMuUKYgkdDBA9pIdMJnk4= +github.com/antchfx/htmlquery v1.2.5/go.mod h1:2MCVBzYVafPBmKbrmwB9F5xdd+IEgRY61ci2oOsOQVw= +github.com/antchfx/xpath v1.2.1 h1:qhp4EW6aCOVr5XIkT+l6LJ9ck/JsUH/yyauNgTQkBF8= +github.com/antchfx/xpath v1.2.1/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211211185417-43fb4c2dbe28 h1:Knil/MO9lpB4pm95yUamKfWeHGAQ2LEeAsXYy30qf8M= github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211211185417-43fb4c2dbe28/go.mod h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -33,25 +33,23 @@ github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/jarcoal/httpmock v1.1.0 h1:F47ChZj1Y2zFsCXxNkBPwNNKnAyOATcdQibk0qEdVCE= -github.com/jarcoal/httpmock v1.1.0/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= -github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jarcoal/httpmock v1.2.0 h1:gSvTxxFR/MEMfsGrvRbdfpRUMBStovlSRLw0Ep1bwwc= +github.com/jarcoal/httpmock v1.2.0/go.mod h1:oCoTsnAz4+UoOUIf5lJOWV2QQIW5UoeUI6aM2YnWAZk= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/klauspost/cpuid/v2 v2.0.5/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/mafredri/cdp v0.32.0 h1:JzW2F+zVK2y9ZhbNWyjrwafZLL9oNnl9Tf6JQ149Og8= github.com/mafredri/cdp v0.32.0/go.mod h1:YTCwLXkZSa18SGSIxCPMOGZcUJODZSNlAhiMqbyxWJg= github.com/mafredri/go-lint v0.0.0-20180911205320-920981dfc79e/go.mod h1:k/zdyxI3q6dup24o8xpYjJKTCf2F7rfxLp6w/efTiWs= +github.com/maxatome/go-testdeep v1.11.0 h1:Tgh5efyCYyJFGUYiT0qxBSIDeXw0F5zSoatlou685kk= +github.com/maxatome/go-testdeep v1.11.0/go.mod h1:011SgQ6efzZYAen6fDn4BqQ+lUR72ysdyKe7Dyogw70= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -60,8 +58,10 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.26.1 h1:/ihwxqH+4z8UxyI70wM1z9yCvkWcfz/a3mj48k/Zngc= github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc= -github.com/segmentio/encoding v0.2.19 h1:Kshkmoz080qvUtdtakR8Bjk2sIlLS8wSvijFMEHRGow= -github.com/segmentio/encoding v0.2.19/go.mod h1:7E68jTSWMnNoYhHi1JbLd7NBSB6XfE4vzqhR88hDBQc= +github.com/segmentio/asm v1.1.3 h1:WM03sfUOENvvKexOLp+pCqgb/WDjsi7EK8gIsICtzhc= +github.com/segmentio/asm v1.1.3/go.mod h1:Ld3L4ZXGNcSLRg4JBsZ3//1+f/TjYl0Mzen/DQy1EJg= +github.com/segmentio/encoding v0.3.4 h1:WM4IBnxH8B9TakiM2QD5LyNl9JSndh88QbHqVC+Pauc= +github.com/segmentio/encoding v0.3.4/go.mod h1:n0JeuIqEQrQoPDGsjo8UNd1iA0U8d8+oHAA4E3G3OxM= github.com/sethgrid/pester v1.1.0 h1:IyEAVvwSUPjs2ACFZkBe5N59BBUpSIkQ71Hr6cM5A+w= github.com/sethgrid/pester v1.1.0/go.mod h1:Ad7IjTpvzZO8Fl0vh9AzQ+j/jYZfyp2diGwI8m5q+ns= github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs= @@ -74,8 +74,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/wI2L/jettison v0.7.3 h1:xvcEkxZap0X36Q/D2Vxe8XenI09TDrTo6XEOkWpjcDU= -github.com/wI2L/jettison v0.7.3/go.mod h1:W3PPso417OeZeWs9nV/olfapp0o4eSZcaeZk4HeSzfM= +github.com/wI2L/jettison v0.7.4 h1:ptjriu75R/k5RAZO0DJzy2t55f7g+dPiBxBY38icaKg= +github.com/wI2L/jettison v0.7.4/go.mod h1:O+F+T7X7ZN6kTsd167Qk4aZMC8jNrH48SMedNmkfPb0= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -107,6 +107,9 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220318055525-2edf467146b5 h1:saXMvIOKvRFwbOMicHXr0B1uwoxq9dGmLe5ExMES6c4= +golang.org/x/sys v0.0.0-20220318055525-2edf467146b5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= diff --git a/pkg/runtime/expressions/operators/operator_test.go b/pkg/runtime/expressions/operators/operator_test.go index 04624b38..72ab5a2b 100644 --- a/pkg/runtime/expressions/operators/operator_test.go +++ b/pkg/runtime/expressions/operators/operator_test.go @@ -1,10 +1,11 @@ package operators_test import ( + "testing" + "github.com/MontFerret/ferret/pkg/runtime/core" "github.com/MontFerret/ferret/pkg/runtime/expressions/operators" "github.com/MontFerret/ferret/pkg/runtime/values" - "testing" . "github.com/smartystreets/goconvey/convey" ) @@ -1023,3 +1024,259 @@ func TestDivide(t *testing.T) { }) }) } + +func TestPositive(t *testing.T) { + Convey("converts value to positive", t, func() { + Convey("when int", func() { + Convey("postive", func() { + So(operators.Positive(values.NewInt(1), nil), ShouldEqual, 1) + }) + Convey("negative", func() { + So(operators.Positive(values.NewInt(-1), nil), ShouldEqual, -1) + }) + }) + + Convey("when float", func() { + Convey("postive", func() { + So(operators.Positive(values.NewFloat(1.0), nil), ShouldEqual, 1) + }) + Convey("negative", func() { + So(operators.Positive(values.NewFloat(-1.0), nil), ShouldEqual, -1.0) + }) + }) + + Convey("non numeric", func() { + Convey("string", func() { + So(operators.Positive(values.String("1"), nil), ShouldEqual, "1") + }) + }) + }) +} + +func TestNegative(t *testing.T) { + Convey("converts value to negative", t, func() { + Convey("when int", func() { + Convey("postive", func() { + So(operators.Negative(values.NewInt(1), nil), ShouldEqual, -1) + }) + Convey("negative", func() { + So(operators.Negative(values.NewInt(-1), nil), ShouldEqual, 1) + }) + }) + + Convey("when float", func() { + Convey("postive", func() { + So(operators.Negative(values.NewFloat(1.0), nil), ShouldEqual, -1.0) + }) + Convey("negative", func() { + So(operators.Negative(values.NewFloat(-1.0), nil), ShouldEqual, 1.0) + }) + }) + + Convey("non numeric", func() { + Convey("string", func() { + So(operators.Negative(values.String("1"), nil), ShouldEqual, "1") + }) + }) + }) +} + +func TestDecrement(t *testing.T) { + Convey("decrement values", t, func() { + Convey("decrement int", func() { + Convey("positives", func() { + So(operators.Decrement(values.NewInt(1), nil), ShouldEqual, 0) + }) + Convey("negatives", func() { + So(operators.Decrement(values.NewInt(-1), nil), ShouldEqual, -2) + }) + }) + + Convey("decrement float", func() { + Convey("positives", func() { + So(operators.Decrement(values.NewFloat(1.1), nil), ShouldEqual, 0.10000000000000009) + }) + Convey("negatives", func() { + So(operators.Decrement(values.NewFloat(-1.1), nil), ShouldEqual, -2.1) + }) + }) + + Convey("other values", func() { + So(operators.Decrement(values.None, nil), ShouldEqual, -1) + }) + }) +} + +func TestIncrement(t *testing.T) { + Convey("increment values", t, func() { + Convey("increment int", func() { + Convey("positives", func() { + So(operators.Increment(values.NewInt(1), nil), ShouldEqual, 2) + }) + Convey("negatives", func() { + So(operators.Increment(values.NewInt(-1), nil), ShouldEqual, 0) + }) + }) + + Convey("Increment float", func() { + Convey("positives", func() { + So(operators.Increment(values.NewFloat(1.1), nil), ShouldEqual, 2.1) + }) + Convey("negatives", func() { + So(operators.Increment(values.NewFloat(-1.1), nil), ShouldEqual, -0.10000000000000009) + }) + }) + + Convey("other values", func() { + So(operators.Increment(values.None, nil), ShouldEqual, 1) + }) + }) +} + +func TestEqual(t *testing.T) { + Convey("Equality in values", t, func() { + Convey("1 == 1", func() { + So(operators.Equal(values.NewInt(1), values.NewInt(1)), ShouldEqual, values.True) + }) + + Convey("1 != 2", func() { + So(operators.Equal(values.NewInt(1), values.NewInt(2)), ShouldEqual, values.False) + }) + + Convey("'hello' == 'hello", func() { + So(operators.Equal(values.String("hello"), values.String("hello")), ShouldEqual, values.True) + }) + + Convey("'foo' != 'bar", func() { + So(operators.Equal(values.String("foo"), values.String("bar")), ShouldEqual, values.False) + }) + }) +} + +func TestNotEqual(t *testing.T) { + Convey("Inequality in values", t, func() { + Convey("1 == 1", func() { + So(operators.NotEqual(values.NewInt(1), values.NewInt(1)), ShouldEqual, values.False) + }) + + Convey("1 != 2", func() { + So(operators.NotEqual(values.NewInt(1), values.NewInt(2)), ShouldEqual, values.True) + }) + + Convey("'hello' == 'hello", func() { + So(operators.NotEqual(values.String("hello"), values.String("hello")), ShouldEqual, values.False) + }) + + Convey("'foo' != 'bar", func() { + So(operators.NotEqual(values.String("foo"), values.String("bar")), ShouldEqual, values.True) + }) + }) +} + +func TestModulus(t *testing.T) { + Convey("Modulus", t, func() { + Convey("5 % 2", func() { + So(operators.Modulus(values.NewInt(5), values.NewInt(2)), ShouldEqual, 1) + }) + + Convey("5.0 % 2", func() { + So(operators.Modulus(values.NewFloat(5.0), values.NewInt(2)), ShouldEqual, 1) + }) + + Convey("5 % 2.0", func() { + So(operators.Modulus(values.NewInt(5), values.NewFloat(2.0)), ShouldEqual, 1) + }) + + Convey("5.1 % 3.2", func() { + So(operators.Modulus(values.NewFloat(5.1), values.NewFloat(3.2)), ShouldEqual, 2) + }) + + Convey("Non int or float", func() { + So(operators.Modulus(values.String("foo"), values.NewFloat(3.2)), ShouldEqual, 0) + }) + }) +} + +func TestGreater(t *testing.T) { + Convey("Greater than value", t, func() { + Convey("5 > 2", func() { + So(operators.Greater(values.NewInt(5), values.NewInt(2)), ShouldEqual, values.True) + }) + + Convey("2 > 5", func() { + So(operators.Greater(values.NewInt(2), values.NewInt(5)), ShouldEqual, values.False) + }) + }) +} + +func TestGreaterOrEqual(t *testing.T) { + Convey("Greater or equal than value", t, func() { + Convey("5 >= 5", func() { + So(operators.GreaterOrEqual(values.NewInt(5), values.NewInt(5)), ShouldEqual, values.True) + }) + + Convey("2 >= 5", func() { + So(operators.GreaterOrEqual(values.NewInt(2), values.NewInt(5)), ShouldEqual, values.False) + }) + }) +} + +func TestLess(t *testing.T) { + Convey("Less than value", t, func() { + Convey("1 < 5", func() { + So(operators.Less(values.NewInt(1), values.NewInt(5)), ShouldEqual, values.True) + }) + Convey("5 < 2", func() { + So(operators.Less(values.NewInt(5), values.NewInt(2)), ShouldEqual, values.False) + }) + }) +} + +func TestLessOrEqual(t *testing.T) { + Convey("Less than value", t, func() { + Convey("1 < 5", func() { + So(operators.LessOrEqual(values.NewInt(1), values.NewInt(5)), ShouldEqual, values.True) + }) + Convey("5 < 2", func() { + So(operators.LessOrEqual(values.NewInt(5), values.NewInt(2)), ShouldEqual, values.False) + }) + Convey("5 <= 5", func() { + So(operators.LessOrEqual(values.NewInt(5), values.NewInt(5)), ShouldEqual, values.True) + }) + }) +} + +func TestNot(t *testing.T) { + Convey("Invert truthiness", t, func() { + Convey("true turns false", func() { + So(operators.Not(values.NewBoolean(true), nil), ShouldEqual, values.False) + }) + Convey("false turns true", func() { + So(operators.Not(values.NewBoolean(false), nil), ShouldEqual, values.True) + }) + Convey("'' turns true", func() { + So(operators.Not(values.NewString(""), nil), ShouldEqual, values.True) + }) + Convey("'foo' turns false", func() { + So(operators.Not(values.NewString("foo"), nil), ShouldEqual, values.False) + }) + Convey("1 turns false", func() { + So(operators.Not(values.NewInt(1), nil), ShouldEqual, values.False) + }) + Convey("0 turns true", func() { + So(operators.Not(values.NewInt(0), nil), ShouldEqual, values.True) + }) + Convey("1.0 turns false", func() { + So(operators.Not(values.NewFloat(1), nil), ShouldEqual, values.False) + }) + Convey("0.0 turns true", func() { + So(operators.Not(values.NewFloat(0.0), nil), ShouldEqual, values.True) + }) + Convey("current turns false", func() { + So(operators.Not(values.NewDateTime(values.NewCurrentDateTime().Time), nil), ShouldEqual, values.False) + }) + Convey("zerotime turns true", func() { + So(operators.Not(values.NewDateTime(values.ZeroDateTime.Time), nil), ShouldEqual, values.True) + }) + }) +}