Skip to content

Commit

Permalink
fix: slightly improve scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret committed Jan 14, 2024
1 parent 39d124e commit 76f8f62
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions lib/commands/new_command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ wasm-bindgen = "=${versions.wasmBindgen}"
"./rs_lib/src/lib.rs",
`use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub fn add(a: i32, b: i32) -> i32 {
return a + b;
}
#[wasm_bindgen]
pub struct Greeter {
name: String,
Expand All @@ -93,22 +98,21 @@ impl Greeter {
}
}
#[wasm_bindgen]
pub fn add(a: i32, b: i32) -> i32 {
return a + b;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let greeter = Greeter::new("world".into());
assert_eq!(greeter.greet(), "hello world!");
fn it_adds() {
let result = add(1, 2);
assert_eq!(result, 3);
}
#[test]
fn it_greets() {
let greeter = Greeter::new("world".into());
assert_eq!(greeter.greet(), "hello world!");
}
}
`,
);
Expand Down

0 comments on commit 76f8f62

Please sign in to comment.