summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-10-07 12:57:25 +1100
committerDamien George <damien.p.george@gmail.com>2016-10-07 12:57:25 +1100
commit82af4d6749072d01195da647f54b79c80f1ad731 (patch)
treecc3d607cb93264b1d0c06dd939e7d03cad660443
parentdffa383b062b0dd788abed0af242b66bde910e6b (diff)
downloadmicropython-82af4d6749072d01195da647f54b79c80f1ad731.tar.gz
micropython-82af4d6749072d01195da647f54b79c80f1ad731.zip
tests: Improve coverage of struct with test for non-compliant behaviour.
-rw-r--r--tests/basics/struct1.py12
-rw-r--r--tests/misc/non_compliant.py7
-rw-r--r--tests/misc/non_compliant.py.exp2
3 files changed, 9 insertions, 12 deletions
diff --git a/tests/basics/struct1.py b/tests/basics/struct1.py
index 1abe34b4c5..b53a9c8bc0 100644
--- a/tests/basics/struct1.py
+++ b/tests/basics/struct1.py
@@ -103,15 +103,3 @@ try:
print(struct.unpack_from('<b', buf, -11))
except:
print('struct.error')
-
-# pack with too many args, not checked by uPy
-#try:
-# print(struct.pack('ii', 1, 2, 3))
-#except:
-# print('struct.error')
-
-# pack with too few args, not checked by uPy
-#try:
-# print(struct.pack('ii', 1))
-#except:
-# print('struct.error')
diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py
index ba2dd15c6a..1157ff8b29 100644
--- a/tests/misc/non_compliant.py
+++ b/tests/misc/non_compliant.py
@@ -1,6 +1,7 @@
# tests for things that are not implemented, or have non-compliant behaviour
import array
+import ustruct
# array deletion not implemented
try:
@@ -87,3 +88,9 @@ try:
del [][2:3:4]
except NotImplementedError:
print('NotImplementedError')
+
+# struct pack with too many args, not checked by uPy
+print(ustruct.pack('bb', 1, 2, 3))
+
+# struct pack with too few args, not checked by uPy
+print(ustruct.pack('bb', 1))
diff --git a/tests/misc/non_compliant.py.exp b/tests/misc/non_compliant.py.exp
index 5937ccb2fb..c03580442d 100644
--- a/tests/misc/non_compliant.py.exp
+++ b/tests/misc/non_compliant.py.exp
@@ -12,3 +12,5 @@ NotImplementedError
NotImplementedError
NotImplementedError
NotImplementedError
+b'\x01\x02'
+b'\x01\x00'