Last active
April 8, 2018 11:31
-
-
Save snnsnn/1f059252234606216cf8721209456287 to your computer and use it in GitHub Desktop.
Test Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Write a function called greet | |
* which takes a name parameter | |
* and returns a String with a greeting | |
* "Hello {name}!" | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn greet(s: &String) -> String { | |
format!("Hello {name}!", name=s) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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