From 3825b3964537ac53c261e6aac807293819380dcc Mon Sep 17 00:00:00 2001 From: Molly Tian Date: Mon, 28 Aug 2023 09:46:06 -0700 Subject: [PATCH] Replace dot notation with quotes notation when referencing exported properties in j2wasm jssuite template. PiperOrigin-RevId: 560737513 --- .../java/com/google/j2cl/junit/apt/WasmJsSuite.vm | 10 +++++----- .../SimpleThrowingStacktraceTest.stacktrace_j2wasm.txt | 2 +- ...owingStacktraceTest.stacktrace_j2wasm_optimized.txt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/junit/generator/java/com/google/j2cl/junit/apt/WasmJsSuite.vm b/junit/generator/java/com/google/j2cl/junit/apt/WasmJsSuite.vm index 2e85f7bd86..a2b45506b2 100644 --- a/junit/generator/java/com/google/j2cl/junit/apt/WasmJsSuite.vm +++ b/junit/generator/java/com/google/j2cl/junit/apt/WasmJsSuite.vm @@ -17,25 +17,25 @@ testSuite({ const absolutePath = "REPLACEMENT_BUILD_PATH_PLACEHOLDER"; instance = await j2wasm.instantiateStreaming(absolutePath); - instance.exports.setUpPageIn${testClass.simpleName()}(); + instance.exports["setUpPageIn${testClass.simpleName()}"](); }, tearDownPage() { // Note that exports might be null due to a failed instantiation. - instance?.exports?.tearDownPageIn${testClass.simpleName()}(); + instance?.exports["tearDownPageIn${testClass.simpleName()}"](); }, setUp() { - instance.exports.setUpIn${testClass.simpleName()}(); + instance.exports["setUpIn${testClass.simpleName()}"](); }, tearDown() { - instance.exports.tearDownIn${testClass.simpleName()}(); + instance.exports["tearDownIn${testClass.simpleName()}"](); }, #foreach($testMethod in ${testClass.testMethods()}) ${testMethod.jsTestMethodName()}() { - instance.exports.${testMethod.jsTestMethodName()}In${testClass.simpleName()}(); + instance.exports["${testMethod.jsTestMethodName()}In${testClass.simpleName()}"](); }, #end diff --git a/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm.txt b/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm.txt index 4405bce274..28d2661925 100644 --- a/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm.txt +++ b/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm.txt @@ -9,5 +9,5 @@ And second line! at m_test__void@com.google.j2cl.junit.integration.stacktrace.data.SimpleThrowingStacktraceTest(SimpleThrowingStacktraceTest.java:27) at m_testInSimpleThrowingStacktraceTest__void@javatests.com.google.j2cl.junit.integration.stacktrace.data.SimpleThrowingStacktraceTest_Adapter(SimpleThrowingStacktraceTest_Adapter.java:43) at m_testInSimpleThrowingStacktraceTest__$export__void@javatests.com.google.j2cl.junit.integration.stacktrace.data.SimpleThrowingStacktraceTest_Adapter(SimpleThrowingStacktraceTest_Adapter.java:41) - at Object.test(junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest-j2wasm_generated_suite.js.zip!/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.js:37:22) + at Object.test(junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest-j2wasm_generated_suite.js.zip!/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.js:37:59) __OPTIONAL__ # Testing infra on J2CL \ No newline at end of file diff --git a/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm_optimized.txt b/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm_optimized.txt index 716b64484e..177fcf2030 100644 --- a/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm_optimized.txt +++ b/junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.stacktrace_j2wasm_optimized.txt @@ -3,5 +3,5 @@ java.lang.RuntimeException: __the_message__! at create(jre/java/super-wasm/exception_utils.js:26:13) at m_createJsError__java_lang_Throwable__javaemul_internal_Exceptions_JsErrorWrapper@javaemul.internal.Exceptions(String.java:747) at m_testInSimpleThrowingStacktraceTest__$export__void@javatests.com.google.j2cl.junit.integration.stacktrace.data.SimpleThrowingStacktraceTest_Adapter(Throwable.java:101) - at Object.test(junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest-j2wasm_optimized_generated_suite.js.zip!/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.js:37:22) + at Object.test(junit/generator/javatests/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest-j2wasm_optimized_generated_suite.js.zip!/com/google/j2cl/junit/integration/stacktrace/data/SimpleThrowingStacktraceTest.js:37:59) __OPTIONAL__ # Testing infra on J2CL \ No newline at end of file