From 156eb24359b61513cb91f8082048c86f1cbe5587 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Sat, 11 Aug 2018 10:09:34 -0400 Subject: [PATCH] Use raw string in paths in webidl-tests generated code This fixes things on Windows, which uses backslashes in their paths --- crates/cli-support/src/js/mod.rs | 2 +- crates/webidl-tests/build.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/cli-support/src/js/mod.rs b/crates/cli-support/src/js/mod.rs index eb28b4add..220f6e704 100644 --- a/crates/cli-support/src/js/mod.rs +++ b/crates/cli-support/src/js/mod.rs @@ -2033,7 +2033,7 @@ impl<'a, 'b> SubContext<'a, 'b> { if let Some(module) = &import.module { if use_node_require { imports.push_str(&format!( - "const {} = require('{}').{};\n", + "const {} = require(String.raw`{}`).{};\n", name, module, name_to_import )); } else if name_to_import == name { diff --git a/crates/webidl-tests/build.rs b/crates/webidl-tests/build.rs index 536ccf07c..909fc8cd1 100644 --- a/crates/webidl-tests/build.rs +++ b/crates/webidl-tests/build.rs @@ -28,7 +28,7 @@ fn main() { use wasm_bindgen::prelude::*; use wasm_bindgen_test::*; - #[wasm_bindgen(module = "{}")] + #[wasm_bindgen(module = r"{}")] extern {{ fn not_actually_a_function{1}(); }}