Skip to content

Commit 1be09c5

Browse files
committed
add (de)serialize tests for "triple" to "tuple" rename
1 parent 6fb2707 commit 1be09c5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/settings.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,48 @@ mod tests {
219219
assert_eq!(settings.profile, Some(Profile::Default));
220220
}
221221

222+
#[test]
223+
fn serialize_host_tuple() {
224+
let mut settings = Settings::default();
225+
settings.default_host_tuple = Some("riscv64a23-unknown-linux-gnu".into());
226+
let toml = settings.stringify().unwrap();
227+
assert_eq!(toml, WITH_NEW_DEFAULT_HOST_NAME);
228+
}
229+
230+
#[test]
231+
fn deserialize_host_tuple_old_name() {
232+
let settings = Settings::parse(WITH_OLD_DEFAULT_HOST_NAME).unwrap();
233+
assert_eq!(
234+
settings.default_host_tuple,
235+
Some("riscv64a23-unknown-linux-gnu".into()),
236+
);
237+
}
238+
239+
#[test]
240+
fn deserialize_host_tuple() {
241+
let settings = Settings::parse(WITH_NEW_DEFAULT_HOST_NAME).unwrap();
242+
assert_eq!(
243+
settings.default_host_tuple,
244+
Some("riscv64a23-unknown-linux-gnu".into()),
245+
);
246+
}
247+
222248
const BASIC: &str = r#"version = "12"
223249
default_toolchain = "stable-aarch64-apple-darwin"
224250
profile = "default"
225251
252+
[overrides]
253+
"#;
254+
255+
const WITH_OLD_DEFAULT_HOST_NAME: &str = r#"version = "12"
256+
default_host_triple = "riscv64a23-unknown-linux-gnu"
257+
258+
[overrides]
259+
"#;
260+
261+
const WITH_NEW_DEFAULT_HOST_NAME: &str = r#"version = "12"
262+
default_host_tuple = "riscv64a23-unknown-linux-gnu"
263+
226264
[overrides]
227265
"#;
228266
}

0 commit comments

Comments
 (0)