Skip to content

Commit 42af710

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

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

src/settings.rs

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

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

0 commit comments

Comments
 (0)