bind: test buffer protocol

Change-Id: I41744bf84a6dc87ee8a372e490068465c248ddd1
This commit is contained in:
Sebastien Binet 2015-08-06 10:01:00 +02:00
parent 8b429c382b
commit 806eaacb48
2 changed files with 4 additions and 0 deletions

View File

@ -157,6 +157,7 @@ except Exception, err:
arr[1] = 42
print "arr:",arr
print "len(arr):",len(arr)
print "mem(arr):",len(memoryview(arr))
print "--- testing slice..."
s = hi.GetIntSlice()
@ -173,4 +174,5 @@ except Exception, err:
s[1] = 42
print "slice:",s
print "len(slice):",len(s)
print "mem(slice):",len(memoryview(s))

View File

@ -145,6 +145,7 @@ arr[1]: 2
arr[2]: caught: array index out of range
arr: [2]int{1, 42}
len(arr): 2
mem(arr): 2
--- testing slice...
slice: []int{1, 2}
len(slice): 2
@ -153,6 +154,7 @@ slice[1]: 2
slice[2]: caught: array index out of range
slice: []int{1, 42}
len(slice): 2
mem(slice): 2
`)
buf := new(bytes.Buffer)
cmd = exec.Command("python2", "./test.py")