MCPcopy Create free account
hub / github.com/zalando/skipper / TestNumberString

Function TestNumberString

eskip/string_test.go:296–328  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

294}
295
296func TestNumberString(t *testing.T) {
297 for _, ti := range []float64{
298 0,
299 1,
300 0.1,
301 0.123,
302 0.123456789,
303 0.12345678901234568901234567890,
304 123,
305 123456789,
306 123456789012345678901234567890,
307 } {
308 t.Run(fmt.Sprint(ti), func(t *testing.T) {
309 in := &Route{Filters: []*Filter{{Name: "filter", Args: []interface{}{ti}}}}
310 str := String(in)
311 t.Log("output", str)
312 out, err := Parse(str)
313 if err != nil {
314 t.Error(err)
315 return
316 }
317
318 if len(out) != 1 || len(out[0].Filters) != 1 || len(out[0].Filters[0].Args) != 1 {
319 t.Error("parse failed")
320 return
321 }
322
323 if v, ok := out[0].Filters[0].Args[0].(float64); !ok || v != ti {
324 t.Error("print/parse failed", v, ti)
325 }
326 })
327 }
328}
329
330func TestPrintLines(t *testing.T) {
331 check := func(t *testing.T, got, expected string) {

Callers

nothing calls this directly

Calls 4

StringFunction · 0.85
LogMethod · 0.80
ParseFunction · 0.70
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…