diff options
author | CfirTsabari <cfir16@gmail.com> | 2022-03-27 11:22:53 +0000 |
---|---|---|
committer | CfirTsabari <cfir16@gmail.com> | 2022-04-10 18:37:35 +0000 |
commit | 34ea07a8a714fd4c8d4b4bc0606e2d536dc275d5 (patch) | |
tree | 1bd52456c912a832b637a0728b9c6c8c355fc98c /tests | |
parent | 8f1ccff320aa81eed85d4d4d686b56d2dd0e5643 (diff) |
fix: dot in config name
Rust std `set_extension` is either add an extension if none exists, or
edit the current one if such exists.
This caused a mishandling when user is using a name with a dot,
part of the name was treated as an extension, and be overwritten by
the different format extensions.
So manually *adding* a new dummy extension will cause the current code,
to behave as expected, since it will always overwrite the new dummy
extension and not part of the name.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Settings2.default.ini | 9 | ||||
-rw-r--r-- | tests/file.rs | 10 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/Settings2.default.ini b/tests/Settings2.default.ini new file mode 100644 index 0000000..16badd4 --- /dev/null +++ b/tests/Settings2.default.ini @@ -0,0 +1,9 @@ +debug = true
+production = false
+[place]
+name = Torre di Pisa
+longitude = 43.7224985
+latitude = 10.3970522
+favorite = false
+reviews = 3866
+rating = 4.5
diff --git a/tests/file.rs b/tests/file.rs index 7bd576e..9e4469a 100644 --- a/tests/file.rs +++ b/tests/file.rs @@ -58,3 +58,13 @@ fn test_file_ext() { assert_eq!(c.get("debug").ok(), Some(true)); assert_eq!(c.get("production").ok(), Some(false)); } +#[test] +fn test_file_second_ext() { + let c = Config::builder() + .add_source(File::with_name("tests/Settings2.default")) + .build() + .unwrap(); + + assert_eq!(c.get("debug").ok(), Some(true)); + assert_eq!(c.get("production").ok(), Some(false)); +} |