mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-10-30 22:54:07 +00:00 
			
		
		
		
	Added integration tests
This commit is contained in:
		
							
								
								
									
										1
									
								
								tests/examples/80-columns.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/examples/80-columns.txt
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz | ||||
| @@ -1479,6 +1479,101 @@ fn ignored_suffix_arg() { | ||||
|         .stderr(""); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn no_line_wrapping_when_set_to_never() { | ||||
|     let expected = | ||||
| "───────┬──────────────────────────────────────────────────────────────────────── | ||||
|        │ File: 80-columns.txt | ||||
|        │ Size: 101 B | ||||
| ───────┼──────────────────────────────────────────────────────────────────────── | ||||
|    1   │ abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyz | ||||
| ───────┴──────────────────────────────────────────────────────────────────────── | ||||
| "; | ||||
|  | ||||
|     bat() | ||||
|         .arg("--style=full") | ||||
|         .arg("--decorations=always") | ||||
|         .arg("--wrap=never") | ||||
|         .arg("--terminal-width=80") | ||||
|         .arg("80-columns.txt") | ||||
|         .assert() | ||||
|         .success() | ||||
|         .stdout(expected) | ||||
|         .stderr(""); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn line_wrapping_when_auto() { | ||||
|     let expected = | ||||
|         "───────┬──────────────────────────────────────────────────────────────────────── | ||||
|        │ File: 80-columns.txt | ||||
|        │ Size: 101 B | ||||
| ───────┼──────────────────────────────────────────────────────────────────────── | ||||
|    1   │ abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstu | ||||
|        │ vxyzabcdefghigklmnopqrstuvxyz | ||||
| ───────┴──────────────────────────────────────────────────────────────────────── | ||||
| "; | ||||
|  | ||||
|     bat() | ||||
|         .arg("--style=full") | ||||
|         .arg("--decorations=always") | ||||
|         .arg("--wrap=auto") | ||||
|         .arg("--terminal-width=80") | ||||
|         .arg("80-columns.txt") | ||||
|         .assert() | ||||
|         .success() | ||||
|         .stdout(expected) | ||||
|         .stderr(""); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn line_wrapping_with_s_flag() { | ||||
|     let expected = | ||||
|         "───────┬──────────────────────────────────────────────────────────────────────── | ||||
|        │ File: 80-columns.txt | ||||
|        │ Size: 101 B | ||||
| ───────┼──────────────────────────────────────────────────────────────────────── | ||||
|    1   │ abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstu | ||||
|        │ vxyzabcdefghigklmnopqrstuvxyz | ||||
| ───────┴──────────────────────────────────────────────────────────────────────── | ||||
| "; | ||||
|  | ||||
|     bat() | ||||
|         .arg("--style=full") | ||||
|         .arg("--decorations=always") | ||||
|         .arg("-S") | ||||
|         .arg("--terminal-width=80") | ||||
|         .arg("80-columns.txt") | ||||
|         .assert() | ||||
|         .success() | ||||
|         .stdout(expected) | ||||
|         .stderr(""); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn chop_long_lines_when_specified() { | ||||
|     let expected = | ||||
|         "───────┬──────────────────────────────────────────────────────────────────────── | ||||
|        │ File: 80-columns.txt | ||||
|        │ Size: 101 B | ||||
| ───────┼──────────────────────────────────────────────────────────────────────── | ||||
|    1   │ abcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstuvxyzabcdefghigklmnopqrstu | ||||
|        │ vxyzabcdefghigklmnopqrstuvxyz | ||||
| ───────┴──────────────────────────────────────────────────────────────────────── | ||||
| "; | ||||
|  | ||||
|     bat() | ||||
|         .arg("--style=full") | ||||
|         .arg("--decorations=always") | ||||
|         .arg("--chop-long-lines") | ||||
|         .arg("--terminal-width=80") | ||||
|         .arg("80-columns.txt") | ||||
|         .assert() | ||||
|         .success() | ||||
|         .stdout(expected) | ||||
|         .stderr(""); | ||||
| } | ||||
|  | ||||
| #[test] | ||||
| fn highlighting_is_skipped_on_long_lines() { | ||||
|     let expected = "\u{1b}[38;5;231m{\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;208mapi\u{1b}[0m\u{1b}[38;5;208m\"\u{1b}[0m\u{1b}[38;5;231m:\u{1b}[0m\n".to_owned() + | ||||
|   | ||||
		Reference in New Issue
	
	Block a user