Skip to content

Commit

Permalink
chore: add gnovm/tests/challenges/print_ref.gno (#849)
Browse files Browse the repository at this point in the history
* chore: add gnovmm/tests/challenges/print_ref.gno

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>

* chore: fixup

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>

* Update gnovm/tests/challenges/print_ref.gno

Co-authored-by: Morgan <git@howl.moe>

---------

Signed-off-by: Manfred Touron <94029+moul@users.noreply.github.com>
Co-authored-by: Morgan <git@howl.moe>
  • Loading branch information
moul and thehowl authored May 26, 2023
1 parent 9726b18 commit d661cd2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gnovm/tests/challenges/print_ref.gno
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// PKGPATH: gno.land/r/demo/tests_test
package tests_test

var (
ss1 = []string{"A1"}
ss2 = []string{"A2"}
)

// this bug seems to be limited to slices and potentially only when using `println`.

func main() {
println("ss1", ss1) // unexpected print
println("ss1", ss1) // unexpected print
_ = ss1
println("ss1", ss1) // expected print

println("ss2", ss2, ss2[0]) // expected print
}

// Output:
// ss1 slice[ref(0e4830f6b0cb49c615cab8df855d8dd0f7ebc58c:4)]
// ss1 slice[ref(0e4830f6b0cb49c615cab8df855d8dd0f7ebc58c:4)]
// ss1 slice[("A1" string)]
// ss2 slice[("A2" string)] A2

0 comments on commit d661cd2

Please sign in to comment.