cx icon indicating copy to clipboard operation
cx copied to clipboard

Wrong sprintf behaviour when printing boolean values with %v

Open vidya88 opened this issue 5 years ago • 0 comments

@asahi3g commented on Mar 12

To Reproduce

package main

type too struct {
	b bool
}

func main()()  {
	var t0 too // comment these 2 lines and the error disappears
	t0.b = true // comment these 2 lines and the error disappears
	var t1 too
	t1.b = false
	var sb str = sprintf("%v", t1.b)
	printf("'%s'\n", sb)
	test(sb, "false", "")
}

Expected behavior Test should print 'false' and pass

Screenshots

'true'
byts1 [116 114 117 101]
byts2 [102 97 108 115 101]
tests/pending_2.cx: 15: result was not equal to the expected value

Desktop:

  • OS: Linux
  • CX Version : 0.6.1, d8775bf

vidya88 avatar Sep 24 '19 05:09 vidya88