summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/string1.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-21 02:22:02 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-21 02:25:59 +0200
commit7380a837802b4630bdcef6e01cd5be32f92750ca (patch)
tree8a26b5e0ab0581819d7d57e91992b7347103627d /tests/basics/string1.py
parent545591a696bdff73f68573c54a05ca70eb58032d (diff)
downloadmicropython-7380a837802b4630bdcef6e01cd5be32f92750ca.tar.gz
micropython-7380a837802b4630bdcef6e01cd5be32f92750ca.zip
str: Implement proper string (instead of byte string) indexing.
Also, support negative indexes.
Diffstat (limited to 'tests/basics/string1.py')
-rw-r--r--tests/basics/string1.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/basics/string1.py b/tests/basics/string1.py
index 40e766b594..074b04ef8f 100644
--- a/tests/basics/string1.py
+++ b/tests/basics/string1.py
@@ -10,6 +10,17 @@ print('123' + "456")
print('123' * 5)
+print('abc'[1])
+print('abc'[-1])
+try:
+ 'abc'[100]
+except IndexError:
+ print('caught')
+try:
+ 'abc'[-4]
+except IndexError:
+ print('caught2')
+
# iter
print(list('str'))