MCPcopy
hub / github.com/expr-lang/expr / TestNegative

Function TestNegative

internal/testify/assert/assertion_compare_test.go:344–381  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

342}
343
344func TestNegative(t *testing.T) {
345 mockT := new(testing.T)
346
347 if !Negative(mockT, -1) {
348 t.Error("Negative should return true")
349 }
350
351 if !Negative(mockT, -1.23) {
352 t.Error("Negative should return true")
353 }
354
355 if Negative(mockT, 1) {
356 t.Error("Negative should return false")
357 }
358
359 if Negative(mockT, 1.23) {
360 t.Error("Negative should return false")
361 }
362
363 // Check error report
364 for _, currCase := range []struct {
365 e interface{}
366 msg string
367 }{
368 {e: int(1), msg: `"1" is not negative`},
369 {e: int8(1), msg: `"1" is not negative`},
370 {e: int16(1), msg: `"1" is not negative`},
371 {e: int32(1), msg: `"1" is not negative`},
372 {e: int64(1), msg: `"1" is not negative`},
373 {e: float32(1.23), msg: `"1.23" is not negative`},
374 {e: float64(1.23), msg: `"1.23" is not negative`},
375 } {
376 out := &outputT{buf: bytes.NewBuffer(nil)}
377 False(t, Negative(out, currCase.e))
378 Contains(t, out.buf.String(), currCase.msg)
379 Contains(t, out.helpers, "github.com/expr-lang/expr/internal/testify/assert.Negative")
380 }
381}
382
383func Test_compareTwoValuesDifferentValuesTypes(t *testing.T) {
384 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 5

NegativeFunction · 0.70
FalseFunction · 0.70
ContainsFunction · 0.70
StringMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…