Skip to content

Commit 3ea65f9

Browse files
committed
[test] test inner function in nwjc
1 parent d94ad01 commit 3ea65f9

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

test/sanity/nwjc/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
<script>
99
mytest(2);
1010
document.write('<p id="result2">' + mytest.toString() + '</p>');
11+
testinner(2);
12+
document.write('<p id="result4">' + testinner.toString() + '</p>');
1113
</script>
1214
</body></html>

test/sanity/nwjc/mytest.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
function mytest(a) {
22
document.write("<p id='result'>" + (a + 42) + "</p>");
33
}
4+
5+
function testinner(a) {
6+
function foo(a) {
7+
document.write("<p id='result3'>" + (a + 42) + "</p>");
8+
}
9+
foo(a);
10+
}

test/sanity/nwjc/test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
out, err = proc.communicate()
2727
print out
2828
assert("42" not in out)
29+
assert("foo" not in out)
2930

3031
driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
3132
try:
@@ -36,6 +37,10 @@
3637
assert("44" == result.get_attribute('innerHTML'))
3738
result2 = driver.find_element_by_id('result2').get_attribute('innerHTML')
3839
print result2
39-
assert("native code" in result2)
40+
assert("function mytest() { [native code] }" == result2)
41+
result3 = driver.find_element_by_id('result3').get_attribute('innerHTML')
42+
result4 = driver.find_element_by_id('result4').get_attribute('innerHTML')
43+
assert("44" == result3)
44+
assert("function testinner() { [native code] }" == result4)
4045
finally:
4146
driver.quit()

0 commit comments

Comments
 (0)