Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
82f37bf0
Commit
82f37bf0
authored
Apr 03, 2015
by
Damien George
Browse files
tests: Add specific test for closures in native emitter.
parent
fa5950eb
Changes
2
Hide whitespace changes
Inline
Side-by-side
tests/micropython/native_closure.py
0 → 100644
View file @
82f37bf0
# test native emitter can handle closures correctly
# basic closure
@
micropython
.
native
def
f
():
x
=
1
@
micropython
.
native
def
g
():
nonlocal
x
return
x
return
g
print
(
f
()())
# closing over an argument
@
micropython
.
native
def
f
(
x
):
@
micropython
.
native
def
g
():
nonlocal
x
return
x
return
g
print
(
f
(
2
)())
# closing over an argument and a normal local
@
micropython
.
native
def
f
(
x
):
y
=
2
*
x
@
micropython
.
native
def
g
(
z
):
return
x
+
y
+
z
return
g
print
(
f
(
2
)(
3
))
tests/micropython/native_closure.py.exp
0 → 100644
View file @
82f37bf0
1
2
9
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment