Skip to content

Instantly share code, notes, and snippets.

@eduardonunesp
Created January 4, 2022 16:27
Show Gist options
  • Save eduardonunesp/0a1901a15cceb4b6a0f2c3f6603d69b0 to your computer and use it in GitHub Desktop.
Save eduardonunesp/0a1901a15cceb4b6a0f2c3f6603d69b0 to your computer and use it in GitHub Desktop.
#[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