gstreamer: error: add tests

This commit is contained in:
Guillaume Desmottes 2020-01-10 18:41:04 +05:30
parent 1f79bf3e02
commit e151ee75f8

View file

@ -197,3 +197,33 @@ impl Error for LoggableError {
self.bool_error.message.as_ref() self.bool_error.message.as_ref()
} }
} }
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn error_message() {
let e = ErrorMessage::new(
&::CoreError::Failed,
Some("message"),
Some("debug"),
"filename",
"function",
7,
);
assert_eq!(
format!("{}", e),
"Error Some(\"message\") (Some(\"debug\")) at filename:7"
);
}
#[test]
fn logabble_error() {
let e: LoggableError = glib::BoolError::new("msg", "filename", "function", 7).into();
assert_eq!(
format!("{}", e),
"Error \"GST_RUST\": \"msg\" at filename:7"
);
}
}