1
0
Fork 0
mirror of https://github.com/sile/hls_m3u8.git synced 2024-11-25 08:31:00 +00:00

added pretty_assertions

This will allow for better troubleshooting of failing test, because you 
don't have to search for the difference (between left and right). This 
is especially helpful for larger assertions.
This commit is contained in:
Luro02 2019-10-08 15:42:33 +02:00
parent e75153ec5e
commit c53e9e33f1
46 changed files with 47 additions and 0 deletions

View file

@ -25,3 +25,4 @@ hex = "0.4.0"
[dev-dependencies] [dev-dependencies]
clap = "2.33.0" clap = "2.33.0"
pretty_assertions = "0.6.1"

View file

@ -96,6 +96,7 @@ fn split(value: &str, terminator: char) -> Vec<String> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_parser() { fn test_parser() {

View file

@ -445,6 +445,7 @@ impl FromStr for MasterPlaylist {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_parser() { fn test_parser() {

View file

@ -379,6 +379,7 @@ impl FromStr for MediaPlaylist {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn too_large_segment_duration_test() { fn too_large_segment_duration_test() {

View file

@ -192,6 +192,7 @@ impl Encrypted for MediaSegment {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
use std::time::Duration; use std::time::Duration;
#[test] #[test]

View file

@ -62,6 +62,7 @@ impl FromStr for ExtM3u {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -104,6 +104,7 @@ impl FromStr for ExtXVersion {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -190,6 +190,7 @@ impl DerefMut for ExtXIFrameStreamInf {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_builder() { fn test_builder() {

View file

@ -740,6 +740,7 @@ impl FromStr for ExtXMedia {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -324,6 +324,7 @@ impl FromStr for ExtXSessionData {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -86,6 +86,7 @@ impl DerefMut for ExtXSessionKey {
mod test { mod test {
use super::*; use super::*;
use crate::types::{EncryptionMethod, KeyFormat}; use crate::types::{EncryptionMethod, KeyFormat};
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -376,6 +376,7 @@ impl DerefMut for ExtXStreamInf {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_parser() { fn test_parser() {

View file

@ -84,6 +84,7 @@ impl FromStr for ExtXDiscontinuitySequence {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -45,6 +45,7 @@ impl FromStr for ExtXEndList {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -47,6 +47,7 @@ impl FromStr for ExtXIFramesOnly {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -81,6 +81,7 @@ impl FromStr for ExtXMediaSequence {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -61,6 +61,7 @@ impl FromStr for ExtXPlaylistType {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_parser() { fn test_parser() {

View file

@ -73,6 +73,7 @@ impl FromStr for ExtXTargetDuration {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -104,6 +104,7 @@ impl FromStr for ExtXByteRange {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -823,6 +823,7 @@ impl fmt::Display for ExtXDateRange {
mod test { mod test {
use super::*; use super::*;
use chrono::offset::TimeZone; use chrono::offset::TimeZone;
use pretty_assertions::assert_eq;
const HOURS_IN_SECS: i32 = 3600; // 1 hour = 3600 seconds const HOURS_IN_SECS: i32 = 3600; // 1 hour = 3600 seconds

View file

@ -44,6 +44,7 @@ impl FromStr for ExtXDiscontinuity {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -178,6 +178,7 @@ impl From<Duration> for ExtInf {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -113,6 +113,7 @@ impl DerefMut for ExtXKey {
mod test { mod test {
use super::*; use super::*;
use crate::types::{EncryptionMethod, KeyFormat}; use crate::types::{EncryptionMethod, KeyFormat};
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -194,6 +194,7 @@ impl FromStr for ExtXMap {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -133,6 +133,7 @@ impl DerefMut for ExtXProgramDateTime {
mod test { mod test {
use super::*; use super::*;
use chrono::{Datelike, TimeZone}; use chrono::{Datelike, TimeZone};
use pretty_assertions::assert_eq;
const HOURS_IN_SECS: i32 = 3600; // 1 hour = 3600 seconds const HOURS_IN_SECS: i32 = 3600; // 1 hour = 3600 seconds

View file

@ -35,6 +35,7 @@ impl FromStr for ExtXIndependentSegments {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -157,6 +157,7 @@ impl FromStr for ExtXStart {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -114,6 +114,7 @@ impl FromStr for ByteRange {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -103,6 +103,7 @@ impl fmt::Display for Channels {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -40,6 +40,7 @@ impl FromStr for ClosedCaptions {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -69,6 +69,7 @@ impl From<f32> for DecimalFloatingPoint {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
macro_rules! test_from { macro_rules! test_from {
( $($input:expr),* ) => { ( $($input:expr),* ) => {

View file

@ -68,6 +68,7 @@ impl FromStr for DecimalResolution {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -353,6 +353,7 @@ impl fmt::Display for DecryptionKey {
mod test { mod test {
use super::*; use super::*;
use crate::types::EncryptionMethod; use crate::types::EncryptionMethod;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_builder() { fn test_builder() {

View file

@ -50,6 +50,7 @@ pub enum EncryptionMethod {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -17,6 +17,7 @@ pub enum HdcpLevel {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -81,6 +81,7 @@ pub enum InStreamId {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
macro_rules! gen_tests { macro_rules! gen_tests {
( $($string:expr => $enum:expr),* ) => { ( $($string:expr => $enum:expr),* ) => {

View file

@ -66,6 +66,7 @@ impl FromStr for InitializationVector {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -39,6 +39,7 @@ impl RequiredVersion for KeyFormat {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -97,6 +97,7 @@ impl<T: Into<Vec<usize>>> From<T> for KeyFormatVersions {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -14,6 +14,7 @@ pub enum MediaType {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_parser() { fn test_parser() {

View file

@ -73,6 +73,7 @@ impl Default for ProtocolVersion {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -36,6 +36,7 @@ impl Deref for SignedDecimalFloatingPoint {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
macro_rules! test_from { macro_rules! test_from {
( $( $input:expr => $output:expr ),* ) => { ( $( $input:expr => $output:expr ),* ) => {

View file

@ -300,6 +300,7 @@ impl FromStr for StreamInf {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -67,6 +67,7 @@ impl From<&str> for Value {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_display() { fn test_display() {

View file

@ -83,6 +83,7 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_parse_yes_or_no() { fn test_parse_yes_or_no() {

View file

@ -1,6 +1,8 @@
use hls_m3u8::tags::{ExtXIFrameStreamInf, ExtXStreamInf}; use hls_m3u8::tags::{ExtXIFrameStreamInf, ExtXStreamInf};
use hls_m3u8::MasterPlaylist; use hls_m3u8::MasterPlaylist;
use pretty_assertions::assert_eq;
#[test] #[test]
fn test_master_playlist() { fn test_master_playlist() {
let master_playlist = "#EXTM3U\n\ let master_playlist = "#EXTM3U\n\