From 7a97e4351b4d78f64c3d1fbecd497481e649a83f Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 18 Jan 2021 00:29:18 +1100 Subject: tests: Move native for test from pybnative to micropython. And make it generic so it can be run on any target. Signed-off-by: Damien George --- tests/micropython/native_for.py | 19 +++++++++++++++++++ tests/micropython/native_for.py.exp | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/micropython/native_for.py create mode 100644 tests/micropython/native_for.py.exp (limited to 'tests/micropython') diff --git a/tests/micropython/native_for.py b/tests/micropython/native_for.py new file mode 100644 index 000000000..c640a8d08 --- /dev/null +++ b/tests/micropython/native_for.py @@ -0,0 +1,19 @@ +# test for native for loops + + +@micropython.native +def f1(n): + for i in range(n): + print(i) + + +f1(4) + + +@micropython.native +def f2(r): + for i in r: + print(i) + + +f2(range(4)) diff --git a/tests/micropython/native_for.py.exp b/tests/micropython/native_for.py.exp new file mode 100644 index 000000000..d4dc73eff --- /dev/null +++ b/tests/micropython/native_for.py.exp @@ -0,0 +1,8 @@ +0 +1 +2 +3 +0 +1 +2 +3 -- cgit v1.2.3