aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-06-10 03:02:16 +0000
committerFuwn <[email protected]>2022-06-10 03:02:16 +0000
commitff518622bfed876d92cad857df09591e9f2a89c8 (patch)
treeb5fe728cb0fe884dbcafc89c8fb8eea5c20cfc4f /tests
parentfeat(meta): impl ToString for Meta (diff)
downloadgerm-ff518622bfed876d92cad857df09591e9f2a89c8.tar.xz
germ-ff518622bfed876d92cad857df09591e9f2a89c8.zip
feat(meta): mutable access to meta for construction
Diffstat (limited to 'tests')
-rw-r--r--tests/meta.rs23
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";