aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata
diff options
context:
space:
mode:
authorKonstantin Yegupov <[email protected]>2019-01-30 23:22:29 +1000
committerAyke van Laethem <[email protected]>2019-01-31 16:34:59 +0100
commitf8a1e5f4491b8206b23f351721c9b10e37526c8c (patch)
tree0a030aea7e49be6e0ffcbed1f195b733069fe26b /testdata
parent0308c92e67f833ea83c9699c78c26a192bff89dc (diff)
downloadtinygo-f8a1e5f4491b8206b23f351721c9b10e37526c8c.tar.gz
tinygo-f8a1e5f4491b8206b23f351721c9b10e37526c8c.zip
interp: support map literals with integer keys
Diffstat (limited to 'testdata')
-rw-r--r--testdata/map.go4
-rw-r--r--testdata/map.txt2
2 files changed, 6 insertions, 0 deletions
diff --git a/testdata/map.go b/testdata/map.go
index 66699390c..5b97bf5dd 100644
--- a/testdata/map.go
+++ b/testdata/map.go
@@ -15,6 +15,7 @@ var testmap2 = map[string]int{
"eleven": 11,
"twelve": 12,
}
+var testmapIntInt = map[int]int{1: 1, 2: 4, 3: 9}
func main() {
m := map[string]int{"answer": 42, "foo": 3}
@@ -31,6 +32,9 @@ func main() {
var nilmap map[string]int
println(m == nil, m != nil, len(m))
println(nilmap == nil, nilmap != nil, len(nilmap))
+ println(testmapIntInt[2])
+ testmapIntInt[2] = 42
+ println(testmapIntInt[2])
}
func readMap(m map[string]int, key string) {
diff --git a/testdata/map.txt b/testdata/map.txt
index 31ea290ff..a11e421c6 100644
--- a/testdata/map.txt
+++ b/testdata/map.txt
@@ -50,3 +50,5 @@ lookup with comma-ok: eight 8 true
lookup with comma-ok: nokey 0 false
false true 2
true false 0
+4
+42