diff options
| author | Fuwn <[email protected]> | 2022-06-10 03:02:16 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-06-10 03:02:16 +0000 |
| commit | ff518622bfed876d92cad857df09591e9f2a89c8 (patch) | |
| tree | b5fe728cb0fe884dbcafc89c8fb8eea5c20cfc4f /tests | |
| parent | feat(meta): impl ToString for Meta (diff) | |
| download | germ-ff518622bfed876d92cad857df09591e9f2a89c8.tar.xz germ-ff518622bfed876d92cad857df09591e9f2a89c8.zip | |
feat(meta): mutable access to meta for construction
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/meta.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/meta.rs b/tests/meta.rs index 2bcccf1..70c8adc 100644 --- a/tests/meta.rs +++ b/tests/meta.rs @@ -21,6 +21,29 @@ mod test { use germ::meta::Meta; #[test] + fn construct_meta_with_mime() { + let mut meta = Meta::new(); + + *meta.mime_mut() = "text/gemini".to_string(); + + assert_eq!(meta.to_string(), "text/gemini"); + } + + #[test] + fn construct_meta_with_mime_and_parameters() { + let mut meta = Meta::new(); + let mut parameters = std::collections::HashMap::new(); + + parameters.insert("hi".to_string(), "2".to_string()); + parameters.insert("hi2".to_string(), "string=2".to_string()); + + *meta.mime_mut() = "text/gemini".to_string(); + *meta.parameters_mut() = parameters; + + assert_eq!(meta.to_string(), "text/gemini; hi=2; hi2=string=2"); + } + + #[test] fn meta_to_string_without_parameters() { let original_string = "text/gemini"; |