From 3ea65f986c4567d6aa498cfa3feec514ee1bcf56 Mon Sep 17 00:00:00 2001 From: Roger Wang Date: Wed, 1 Mar 2017 11:03:28 +0800 Subject: [PATCH] [test] test inner function in nwjc --- test/sanity/nwjc/index.html | 2 ++ test/sanity/nwjc/mytest.js | 7 +++++++ test/sanity/nwjc/test.py | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/test/sanity/nwjc/index.html b/test/sanity/nwjc/index.html index 481dfc95b1..0ebb41b301 100644 --- a/test/sanity/nwjc/index.html +++ b/test/sanity/nwjc/index.html @@ -8,5 +8,7 @@ diff --git a/test/sanity/nwjc/mytest.js b/test/sanity/nwjc/mytest.js index 7990ecd1ec..27b1447126 100644 --- a/test/sanity/nwjc/mytest.js +++ b/test/sanity/nwjc/mytest.js @@ -1,3 +1,10 @@ function mytest(a) { document.write("

" + (a + 42) + "

"); } + +function testinner(a) { + function foo(a) { + document.write("

" + (a + 42) + "

"); + } + foo(a); +} diff --git a/test/sanity/nwjc/test.py b/test/sanity/nwjc/test.py index 8ffa9841eb..6b3313e94c 100644 --- a/test/sanity/nwjc/test.py +++ b/test/sanity/nwjc/test.py @@ -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: @@ -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()