Skip to content

Commit

Permalink
[test] test inner function in nwjc
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerwang committed Mar 5, 2017
1 parent d94ad01 commit 3ea65f9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/sanity/nwjc/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<script>
mytest(2);
document.write('<p id="result2">' + mytest.toString() + '</p>');
testinner(2);
document.write('<p id="result4">' + testinner.toString() + '</p>');
</script>
</body></html>
7 changes: 7 additions & 0 deletions test/sanity/nwjc/mytest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
function mytest(a) {
document.write("<p id='result'>" + (a + 42) + "</p>");
}

function testinner(a) {
function foo(a) {
document.write("<p id='result3'>" + (a + 42) + "</p>");
}
foo(a);
}
7 changes: 6 additions & 1 deletion test/sanity/nwjc/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
out, err = proc.communicate()
print out
assert("42" not in out)
assert("foo" not in out)

driver = webdriver.Chrome(executable_path=os.environ['CHROMEDRIVER'], chrome_options=chrome_options)
try:
Expand All @@ -36,6 +37,10 @@
assert("44" == result.get_attribute('innerHTML'))
result2 = driver.find_element_by_id('result2').get_attribute('innerHTML')
print result2
assert("native code" in result2)
assert("function mytest() { [native code] }" == result2)
result3 = driver.find_element_by_id('result3').get_attribute('innerHTML')
result4 = driver.find_element_by_id('result4').get_attribute('innerHTML')
assert("44" == result3)
assert("function testinner() { [native code] }" == result4)
finally:
driver.quit()

0 comments on commit 3ea65f9

Please sign in to comment.