MCPcopy Index your code
hub / github.com/expr-lang/expr / TestPositive

Function TestPositive

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

Source from the content-addressed store, hash-verified

303}
304
305func TestPositive(t *testing.T) {
306 mockT := new(testing.T)
307
308 if !Positive(mockT, 1) {
309 t.Error("Positive should return true")
310 }
311
312 if !Positive(mockT, 1.23) {
313 t.Error("Positive should return true")
314 }
315
316 if Positive(mockT, -1) {
317 t.Error("Positive should return false")
318 }
319
320 if Positive(mockT, -1.23) {
321 t.Error("Positive should return false")
322 }
323
324 // Check error report
325 for _, currCase := range []struct {
326 e interface{}
327 msg string
328 }{
329 {e: int(-1), msg: `"-1" is not positive`},
330 {e: int8(-1), msg: `"-1" is not positive`},
331 {e: int16(-1), msg: `"-1" is not positive`},
332 {e: int32(-1), msg: `"-1" is not positive`},
333 {e: int64(-1), msg: `"-1" is not positive`},
334 {e: float32(-1.23), msg: `"-1.23" is not positive`},
335 {e: float64(-1.23), msg: `"-1.23" is not positive`},
336 } {
337 out := &outputT{buf: bytes.NewBuffer(nil)}
338 False(t, Positive(out, currCase.e))
339 Contains(t, out.buf.String(), currCase.msg)
340 Contains(t, out.helpers, "github.com/expr-lang/expr/internal/testify/assert.Positive")
341 }
342}
343
344func TestNegative(t *testing.T) {
345 mockT := new(testing.T)

Callers

nothing calls this directly

Calls 5

PositiveFunction · 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…