Skip to content

Instantly share code, notes, and snippets.

@snnsnn
Last active April 8, 2018 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snnsnn/1f059252234606216cf8721209456287 to your computer and use it in GitHub Desktop.
Save snnsnn/1f059252234606216cf8721209456287 to your computer and use it in GitHub Desktop.
Test Snippets
/*
* Write a function called greet
* which takes a name parameter
* and returns a String with a greeting
* "Hello {name}!"
*/
fn greet(s: &String) -> String {
format!("Hello {name}!", name=s)
}
#[test]
fn it_works() {
assert_eq!("Hello John!", greet(&"John".to_string()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment