aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDamien George2014-01-21 21:54:15 +0000
committerDamien George2014-01-21 21:54:15 +0000
commit12eaccacda83a15500dae4616b3c37deecb57182 (patch)
tree5ec75424388c0be9e3591f981982d891c07669cc /tests
parent55baff4c9bcbc001cbb8972c289ebfa356d4665b (diff)
parent7280f790881fa174e4d234266ff42f0fe3d847bc (diff)
Merge branch 'master' of github.com:micropython/micropython
Conflicts: py/objstr.c py/py.mk py/stream.c unix/main.c unix/socket.c
Diffstat (limited to 'tests')
-rw-r--r--tests/basics/string1.py13
-rw-r--r--tests/basics/string_split.py7
-rw-r--r--tests/io/file-iter.py3
-rwxr-xr-xtests/run-tests9
4 files changed, 31 insertions, 1 deletions
diff --git a/tests/basics/string1.py b/tests/basics/string1.py
index 3fecf799b..074b04ef8 100644
--- a/tests/basics/string1.py
+++ b/tests/basics/string1.py
@@ -8,6 +8,19 @@ print(x)
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'))
diff --git a/tests/basics/string_split.py b/tests/basics/string_split.py
new file mode 100644
index 000000000..f73cb4291
--- /dev/null
+++ b/tests/basics/string_split.py
@@ -0,0 +1,7 @@
+print("a b".split())
+print(" a b ".split(None))
+print(" a b ".split(None, 1))
+print(" a b ".split(None, 2))
+print(" a b c ".split(None, 1))
+print(" a b c ".split(None, 0))
+print(" a b c ".split(None, -1))
diff --git a/tests/io/file-iter.py b/tests/io/file-iter.py
new file mode 100644
index 000000000..48e873996
--- /dev/null
+++ b/tests/io/file-iter.py
@@ -0,0 +1,3 @@
+f = open("io/data/file1")
+for l in f:
+ print(l)
diff --git a/tests/run-tests b/tests/run-tests
index ef1368725..752138ccc 100755
--- a/tests/run-tests
+++ b/tests/run-tests
@@ -10,7 +10,14 @@ numpassed=0
numfailed=0
namefailed=
-for infile in basics/*.py io/*.py
+if [ $# -eq 0 ]
+then
+ tests="basics/*.py io/*.py"
+else
+ tests="$@"
+fi
+
+for infile in $tests
do
basename=`basename $infile .py`
outfile=${basename}.out