Skip to content

Commit

Permalink
fix: add . (period) support
Browse files Browse the repository at this point in the history
  • Loading branch information
xmanemran authored and neochrome committed Aug 5, 2024
1 parent de0b2cb commit ee0e2a3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/program_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl ProgramEnv {
pub fn params(&mut self, params: &[Parameter]) -> &mut ProgramEnv {
for p in params {
self.params.insert(
p.name.to_ascii_uppercase().replace(['-', '/'], "_"),
p.name.to_ascii_uppercase().replace(['.', '-', '/'], "_"),
p.value.to_string(),
);
}
Expand Down Expand Up @@ -105,9 +105,17 @@ mod tests {
let env = ProgramEnv::new()
.params(&params![("user-name", "user"), ("password", "pass")])
.params(&params![("password", "override")])
.params(&params![("test.token", "test-token")])
.to_map();

assert_eq!(env, map![("USER_NAME", "user"), ("PASSWORD", "override")]);
assert_eq!(
env,
map![
("USER_NAME", "user"),
("PASSWORD", "override"),
("TEST_TOKEN", "test-token")
]
);
}

#[test]
Expand Down

0 comments on commit ee0e2a3

Please sign in to comment.