From fbb477f2ae289b915fa88c6e4118dbea598369f4 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Wed, 16 Jan 2019 14:47:57 +0100 Subject: [PATCH] tests: fix exit code --- _examples/arrays/test.py | 2 ++ _examples/cgo/test.py | 2 ++ _examples/consts/test.py | 1 + _examples/empty/test.py | 1 + _examples/funcs/test.py | 1 + _examples/gostrings/test.py | 2 ++ _examples/hi/test.py | 3 +++ _examples/iface/test.py | 1 + _examples/lot/test.py | 2 ++ _examples/maps/test.py | 2 ++ _examples/named/test.py | 2 ++ _examples/pointers/test.py | 2 ++ _examples/pyerrors/test.py | 2 ++ _examples/rename/test.py | 2 ++ _examples/seqs/test.py | 2 +- _examples/simple/test.py | 2 ++ _examples/sliceptr/test.py | 2 ++ _examples/slices/test.py | 2 ++ _examples/structs/test.py | 2 ++ _examples/unicode/test.py | 1 + _examples/vars/test.py | 2 ++ main_test.go | 21 +++++++++++++++++++++ 22 files changed, 58 insertions(+), 1 deletion(-) diff --git a/_examples/arrays/test.py b/_examples/arrays/test.py index 17e806b..ccdd816 100644 --- a/_examples/arrays/test.py +++ b/_examples/arrays/test.py @@ -11,3 +11,5 @@ print ("Python list:", a) print ("Go array: ", b) print ("arrays.IntSum from Python list:", arrays.IntSum(a)) print ("arrays.IntSum from Go array:", arrays.IntSum(b)) + +print("OK") diff --git a/_examples/cgo/test.py b/_examples/cgo/test.py index 190e1be..3fd4e63 100644 --- a/_examples/cgo/test.py +++ b/_examples/cgo/test.py @@ -10,3 +10,5 @@ import cgo print("cgo.doc: %s" % repr(cgo.__doc__).lstrip('u')) print("cgo.Hi()= %s" % repr(cgo.Hi()).lstrip('u')) print("cgo.Hello(you)= %s" % repr(cgo.Hello("you")).lstrip('u')) + +print("OK") diff --git a/_examples/consts/test.py b/_examples/consts/test.py index c820362..891c46a 100644 --- a/_examples/consts/test.py +++ b/_examples/consts/test.py @@ -21,3 +21,4 @@ print("k2 = %s" % consts.GetKind2()) #print("k3 = %s" % consts.GetKind3()) #print("k4 = %s" % consts.GetKind4()) +print("OK") diff --git a/_examples/empty/test.py b/_examples/empty/test.py index 508965d..7865dd4 100644 --- a/_examples/empty/test.py +++ b/_examples/empty/test.py @@ -9,3 +9,4 @@ import empty as pkg print("doc(pkg):\n%s" % repr(pkg.__doc__).lstrip('u')) +print("OK") diff --git a/_examples/funcs/test.py b/_examples/funcs/test.py index 444d54d..91016b4 100644 --- a/_examples/funcs/test.py +++ b/_examples/funcs/test.py @@ -27,3 +27,4 @@ print("s2.F1 = funcs.GetF1()...") s2.F1 = funcs.GetF1() print("s2.F1() = %s" % s2.F1()) +print("OK") diff --git a/_examples/gostrings/test.py b/_examples/gostrings/test.py index bbb4e1d..012a6ba 100644 --- a/_examples/gostrings/test.py +++ b/_examples/gostrings/test.py @@ -9,3 +9,5 @@ import gostrings print("S1 = %s" % (gostrings.GetS1(),)) print("GetString() = %s" % (gostrings.GetString(),)) + +print("OK") diff --git a/_examples/hi/test.py b/_examples/hi/test.py index 0d7dad8..a42c32b 100644 --- a/_examples/hi/test.py +++ b/_examples/hi/test.py @@ -256,3 +256,6 @@ try: print("mem(slice):",len(memoryview(s))) except Exception as err: print("mem(slice): caught:",err) + pass + +print("OK") diff --git a/_examples/iface/test.py b/_examples/iface/test.py index 4c88eb1..9197eb5 100644 --- a/_examples/iface/test.py +++ b/_examples/iface/test.py @@ -18,3 +18,4 @@ t.F() print("iface.CallIface(t)") iface.CallIface(t) +print("OK") diff --git a/_examples/lot/test.py b/_examples/lot/test.py index 6d99239..3090c4a 100644 --- a/_examples/lot/test.py +++ b/_examples/lot/test.py @@ -12,3 +12,5 @@ print('l.SomeListOfStrings: {}'.format(l.SomeListOfStrings)) print('l.SomeListOfInts: {}'.format(l.SomeListOfInts)) print('l.SomeListOfFloats: {}'.format(l.SomeListOfFloats)) print('l.SomeListOfBools: {}'.format(l.SomeListOfBools)) + +print("OK") diff --git a/_examples/maps/test.py b/_examples/maps/test.py index a7f03c6..7d97041 100644 --- a/_examples/maps/test.py +++ b/_examples/maps/test.py @@ -13,3 +13,5 @@ print('maps.Keys from Go map:', maps.Keys(a)) print('maps.Values from Go map:', maps.Values(a)) print('maps.Keys from Python dictionary:', maps.Keys(b)) print('maps.Values from Python dictionary:', maps.Values(b)) + +print("OK") diff --git a/_examples/named/test.py b/_examples/named/test.py index 9db810f..b95f9d3 100644 --- a/_examples/named/test.py +++ b/_examples/named/test.py @@ -125,3 +125,5 @@ print("s = %s" % (s,)) print("s = named.Slice(xrange(10))") s = named.Slice(xrange(10)) print("s = %s" % (s,)) + +print("OK") diff --git a/_examples/pointers/test.py b/_examples/pointers/test.py index de7e024..f9a4cec 100644 --- a/_examples/pointers/test.py +++ b/_examples/pointers/test.py @@ -14,3 +14,5 @@ print("s.Value = %s" % (s.Value,)) print("pointers.Inc(s)") print("s.Value = %s" % (s.Value,)) + +print("OK") diff --git a/_examples/pyerrors/test.py b/_examples/pyerrors/test.py index 587145b..2112332 100644 --- a/_examples/pyerrors/test.py +++ b/_examples/pyerrors/test.py @@ -16,3 +16,5 @@ def div(a, b): div(5,0) div(5,2) + +print("OK") diff --git a/_examples/rename/test.py b/_examples/rename/test.py index 1db01f0..11387b2 100644 --- a/_examples/rename/test.py +++ b/_examples/rename/test.py @@ -9,3 +9,5 @@ import rename print(rename.say_hi()) print(rename.MyStruct().say_something()) + +print("OK") diff --git a/_examples/seqs/test.py b/_examples/seqs/test.py index 5956f20..c1511d1 100644 --- a/_examples/seqs/test.py +++ b/_examples/seqs/test.py @@ -45,4 +45,4 @@ print("s += [10,20]") s += [10,20] print("s = %s" % (s,)) - +print("OK") diff --git a/_examples/simple/test.py b/_examples/simple/test.py index 82a5900..53412f3 100644 --- a/_examples/simple/test.py +++ b/_examples/simple/test.py @@ -22,3 +22,5 @@ a = 3+4j b = 2+5j print("pkg.Comp64Add(%s, %s) = %s" % (a, b, pkg.Comp128Add(a, b))) print("pkg.Comp128Add(%s, %s) = %s" % (a, b, pkg.Comp128Add(a, b))) + +print("OK") diff --git a/_examples/sliceptr/test.py b/_examples/sliceptr/test.py index e009e2a..fbe815a 100644 --- a/_examples/sliceptr/test.py +++ b/_examples/sliceptr/test.py @@ -16,3 +16,5 @@ print(i) s = sliceptr.StrVector() sliceptr.Convert(i, s) print(s) + +print("OK") diff --git a/_examples/slices/test.py b/_examples/slices/test.py index 774aa60..51c3cc3 100644 --- a/_examples/slices/test.py +++ b/_examples/slices/test.py @@ -23,3 +23,5 @@ si16 = slices.SliceInt16([-2,-3]) si32 = slices.SliceInt32([-3,-4]) si64 = slices.SliceInt64([-4,-5]) print ("signed slice elements:", si8[0], si16[0], si32[0], si64[0]) + +print("OK") diff --git a/_examples/structs/test.py b/_examples/structs/test.py index 7f906db..8853379 100644 --- a/_examples/structs/test.py +++ b/_examples/structs/test.py @@ -71,3 +71,5 @@ try: except Exception as err: print("caught error: %s" % (err,)) pass + +print("OK") diff --git a/_examples/unicode/test.py b/_examples/unicode/test.py index 7e85dbc..fddb151 100644 --- a/_examples/unicode/test.py +++ b/_examples/unicode/test.py @@ -36,3 +36,4 @@ binary_stdout.write(b"encoding.GetString() -> ") binary_stdout.write(gostring_ret.encode("UTF-8")) binary_stdout.write(b"\n") +print("OK") diff --git a/_examples/vars/test.py b/_examples/vars/test.py index 31270f7..8fa901f 100644 --- a/_examples/vars/test.py +++ b/_examples/vars/test.py @@ -51,3 +51,5 @@ print("k2 = %s" % vars.GetKind2()) print("vars.GetDoc() = %s" % repr(vars.GetDoc()).lstrip('u')) print("doc of vars.GetDoc = %s" % repr(vars.GetDoc.__doc__).lstrip('u')) print("doc of vars.SetDoc = %s" % repr(vars.SetDoc.__doc__).lstrip('u')) + +print("OK") diff --git a/main_test.go b/main_test.go index 036b119..ece397b 100644 --- a/main_test.go +++ b/main_test.go @@ -217,6 +217,7 @@ slice[2]: caught: slice index out of range slice: []int{1, 42} len(slice): 2 mem(slice): 2 +OK `), }) @@ -350,6 +351,7 @@ slice[2]: caught: slice index out of range slice: []int{1, 42} len(slice): 2 mem(slice): caught: cannot make memory view because object does not have the buffer interface +OK `), }) } @@ -374,6 +376,7 @@ s2 = funcs.S2()... s2.F1 = funcs.GetF1()... calling F1 s2.F1() = None +OK `), }) } @@ -394,6 +397,7 @@ pkg.Bool(True)= True pkg.Bool(False)= False pkg.Comp64Add((3+4j), (2+5j)) = (5+9j) pkg.Comp128Add((3+4j), (2+5j)) = (5+9j) +OK `), }) } @@ -407,6 +411,7 @@ func TestBindEmpty(t *testing.T) { want: []byte(`empty.init()... [CALLED] doc(pkg): 'Package empty does not expose anything.\nWe may want to wrap and import it just for its side-effects.\n' +OK `), }) } @@ -425,6 +430,7 @@ pointers.Inc(s) ==> go: s.Value==2 <== go: s.Value==3 s.Value = 3 +OK `), }) } @@ -496,6 +502,7 @@ s = named.Slice(range(10)) s = named.Slice{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} s = named.Slice(xrange(10)) s = named.Slice{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} +OK `), }) } @@ -525,6 +532,7 @@ s2child = S2Child{S2: structs.S2{Public:42, private:0}, local: 123} s2child.Public = 42 s2child.local = 123 caught error: 'S2Child' object has no attribute 'private' +OK `), }) } @@ -544,6 +552,7 @@ c6 = 42 c7 = 666.666 k1 = 1 k2 = 2 +OK `), }) } @@ -583,6 +592,7 @@ k2 = 456 vars.GetDoc() = 'A variable with some documentation' doc of vars.GetDoc = 'returns vars.Doc\n\nDoc is a top-level string with some documentation attached.\n' doc of vars.SetDoc = 'sets vars.Doc\n\nDoc is a top-level string with some documentation attached.\n' +OK `), }) } @@ -610,6 +620,7 @@ s += [1,2] s = seqs.Slice{1, 2} s += [10,20] s = seqs.Slice{1, 2, 10, 20} +OK `), }) } @@ -635,6 +646,7 @@ func TestBindCgoPackage(t *testing.T) { want: []byte(`cgo.doc: 'Package cgo tests bindings of CGo-based packages.\n' cgo.Hi()= 'hi from go\n' cgo.Hello(you)= 'hello you from go\n' +OK `), }) } @@ -647,6 +659,7 @@ func TestPyErrors(t *testing.T) { lang: features[path], want: []byte(`Divide by zero. pyerrors.Div(5, 2) = 2 +OK `), }) } @@ -661,6 +674,7 @@ func TestBuiltinArrays(t *testing.T) { Go array: [4]int{1, 2, 3, 4} arrays.IntSum from Python list: 10 arrays.IntSum from Go array: 10 +OK `), }) } @@ -677,6 +691,7 @@ slices.IntSum from Python list: 10 slices.IntSum from Go slice: 10 unsigned slice elements: 1 2 3 4 signed slice elements: -1 -2 -3 -4 +OK `), }) } @@ -693,6 +708,7 @@ maps.Keys from Go map: []int{1, 2} maps.Values from Go map: []float64{3, 5} maps.Keys from Python dictionary: []int{1, 2} maps.Values from Python dictionary: []float64{3, 5} +OK `), }) } @@ -705,6 +721,7 @@ func TestBindStrings(t *testing.T) { lang: features[path], want: []byte(`S1 = S1 GetString() = MyString +OK `), }) } @@ -717,6 +734,7 @@ func TestBindRename(t *testing.T) { lang: features[path], want: []byte(`hi something +OK `), }) } @@ -735,6 +753,7 @@ l.SomeListOfStrings: []string{"some", "list", "of", "strings"} l.SomeListOfInts: []int64{6, 2, 9, 1} l.SomeListOfFloats: []float64{6.6, 2.2, 9.9, 1.1} l.SomeListOfBools: []bool{true, false, true, false} +OK `), }) } @@ -748,6 +767,7 @@ func TestSlicePtr(t *testing.T) { want: []byte(`sliceptr.IntVector{1, 2, 3} sliceptr.IntVector{1, 2, 3, 4} sliceptr.StrVector{"1", "2", "3", "4"} +OK `), }) } @@ -761,6 +781,7 @@ func TestUnicode(t *testing.T) { want: []byte(`encoding.HandleString(bytestr) -> Python byte string encoding.HandleString(unicodestr) -> Python Unicode string 🐱 encoding.GetString() -> Go Unicode string 🐱 +OK `), }) }