Skip to content

Commit b107874

Browse files
authored
Merge pull request #442 from alexcrichton/cdylib
Don't require cdylib crate-type for testing
2 parents 9e1e9b0 + fe48dbd commit b107874

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

src/command/test.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ impl Test {
188188
match self.mode {
189189
BuildMode::Normal => steps![
190190
step_check_rustc_version,
191-
step_check_crate_config,
192191
step_add_wasm_target,
193192
step_build_tests,
194193
step_install_wasm_bindgen,
@@ -213,7 +212,6 @@ impl Test {
213212
step_test_safari if self.safari,
214213
],
215214
BuildMode::Noinstall => steps![
216-
step_check_crate_config,
217215
step_build_tests,
218216
step_install_wasm_bindgen,
219217
step_test_node if self.node,
@@ -234,13 +232,6 @@ impl Test {
234232
Ok(())
235233
}
236234

237-
fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), Error> {
238-
info!(log, "Checking crate configuration...");
239-
self.crate_data.check_crate_config(step)?;
240-
info!(log, "Crate is correctly configured.");
241-
Ok(())
242-
}
243-
244235
fn step_add_wasm_target(&mut self, step: &Step, log: &Logger) -> Result<(), Error> {
245236
info!(&log, "Adding wasm-target...");
246237
build::rustup_add_wasm_target(log, step)?;

tests/all/test.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,51 @@ fn renamed_crate_name_works() {
286286
});
287287
fixture.run(cmd).unwrap();
288288
}
289+
290+
#[test]
291+
fn cdylib_not_required() {
292+
let fixture = fixture::Fixture::new();
293+
fixture
294+
.readme()
295+
.file(
296+
"Cargo.toml",
297+
r#"
298+
[package]
299+
name = "foo"
300+
version = "0.1.0"
301+
authors = []
302+
303+
[dependencies]
304+
wasm-bindgen = "=0.2.21"
305+
306+
[dev-dependencies]
307+
wasm-bindgen-test = "=0.2.21"
308+
"#,
309+
)
310+
.file(
311+
"src/lib.rs",
312+
r#"
313+
pub fn foo() -> u32 { 1 }
314+
"#,
315+
)
316+
.file(
317+
"tests/foo.rs",
318+
r#"
319+
extern crate wasm_bindgen_test;
320+
use wasm_bindgen_test::*;
321+
322+
#[wasm_bindgen_test]
323+
fn smoke() {
324+
foo::foo();
325+
}
326+
"#,
327+
);
328+
fixture.install_local_wasm_bindgen();
329+
let cmd = Command::Test(test::TestOptions {
330+
path: Some(fixture.path.clone()),
331+
node: true,
332+
mode: build::BuildMode::Noinstall,
333+
..Default::default()
334+
});
335+
fixture.run(cmd).unwrap();
336+
}

0 commit comments

Comments
 (0)