mirror of
				https://github.com/pcvolkmer/checkbar.git
				synced 2025-11-04 05:26:12 +00:00 
			
		
		
		
	test: test output depending on environment
This commit is contained in:
		@@ -96,11 +96,15 @@ mod tests {
 | 
				
			|||||||
            state: CheckState::Up,
 | 
					            state: CheckState::Up,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if Term::stdout().is_term() {
 | 
				
			||||||
 | 
					            assert_eq!(check_result.to_string(), "\u{1b}[32mtest\u{1b}[0m")
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            assert_eq!(
 | 
					            assert_eq!(
 | 
				
			||||||
                check_result.to_string(),
 | 
					                check_result.to_string(),
 | 
				
			||||||
                r##"{"color":"#00FF00","full_text":"test","name":"test","separator_block_width":16}"##
 | 
					                r##"{"color":"#00FF00","full_text":"test","name":"test","separator_block_width":16}"##
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[test]
 | 
					    #[test]
 | 
				
			||||||
    fn test_should_display_check_result_warn() {
 | 
					    fn test_should_display_check_result_warn() {
 | 
				
			||||||
@@ -109,11 +113,15 @@ mod tests {
 | 
				
			|||||||
            state: CheckState::Warn,
 | 
					            state: CheckState::Warn,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if Term::stdout().is_term() {
 | 
				
			||||||
 | 
					            assert_eq!(check_result.to_string(), "\u{1b}[33mtest\u{1b}[0m")
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            assert_eq!(
 | 
					            assert_eq!(
 | 
				
			||||||
                check_result.to_string(),
 | 
					                check_result.to_string(),
 | 
				
			||||||
                r##"{"color":"#FFFF00","full_text":"test","name":"test","separator_block_width":16}"##
 | 
					                r##"{"color":"#FFFF00","full_text":"test","name":"test","separator_block_width":16}"##
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    #[test]
 | 
					    #[test]
 | 
				
			||||||
    fn test_should_display_check_result_down() {
 | 
					    fn test_should_display_check_result_down() {
 | 
				
			||||||
@@ -122,9 +130,13 @@ mod tests {
 | 
				
			|||||||
            state: CheckState::Down,
 | 
					            state: CheckState::Down,
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if Term::stdout().is_term() {
 | 
				
			||||||
 | 
					            assert_eq!(check_result.to_string(), "\u{1b}[31mtest\u{1b}[0m")
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
            assert_eq!(
 | 
					            assert_eq!(
 | 
				
			||||||
                check_result.to_string(),
 | 
					                check_result.to_string(),
 | 
				
			||||||
                r##"{"color":"#FF0000","full_text":"test","name":"test","separator_block_width":16}"##
 | 
					                r##"{"color":"#FF0000","full_text":"test","name":"test","separator_block_width":16}"##
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user