Bug 1677763 - [mozdevice-rust] Added tests for formatting own DeviceError types. r=webdriver-reviewers,jgraham

Those checks will make sure that we don't enter
an infinite loop anymore when trying to format
one of our own DeviceError types.

Skupin <mail@hskupin.info> HG: branch 'default' HG: bookmark 'geckodriver_overflow' HG: changed
testing/mozbase/rust/mozdevice/src/test.rs

Differential Revision: https://phabricator.services.mozilla.com/D109057
This commit is contained in:
Henrik Skupin 2021-03-19 14:01:39 +00:00
Родитель 8757457e37
Коммит b753cecd07
1 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -506,3 +506,24 @@ fn device_push_dir() {
},
);
}
#[test]
fn format_own_device_error_types() {
assert_eq!(
format!("{}", DeviceError::InvalidStorage),
"Invalid storage".to_string()
);
assert_eq!(
format!("{}", DeviceError::MissingPackage),
"Missing package".to_string()
);
assert_eq!(
format!("{}", DeviceError::MultipleDevices),
"Multiple Android devices online".to_string()
);
assert_eq!(
format!("{}", DeviceError::Adb("foo".to_string())),
"foo".to_string()
);
}