Created
January 4, 2022 16:27
-
-
Save eduardonunesp/0a1901a15cceb4b6a0f2c3f6603d69b0 to your computer and use it in GitHub Desktop.
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
#[derive(PartialEq, Debug)] | |
enum Language { | |
ENGLISH, | |
PORTUGUESE, | |
} | |
fn select_language(language: Language) -> Language { | |
match language { | |
Language::ENGLISH => println!("English selected"), | |
Language::PORTUGUESE => println!("Portuguese selectionado"), | |
} | |
language | |
} | |
fn main() { | |
select_language(Language::ENGLISH); | |
} | |
#[cfg(test)] | |
mod test { | |
use super::*; | |
#[test] | |
fn internal() { | |
assert_eq!(Language::ENGLISH, select_language(Language::ENGLISH)); | |
assert_eq!(Language::PORTUGUESE, select_language(Language::PORTUGUESE)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment