From afc58eb6ea7adf451f5cf518fdef6922e957ebc8 Mon Sep 17 00:00:00 2001 From: Tilak Patidar Date: Sat, 15 Dec 2018 22:54:01 +0530 Subject: [PATCH] pr: add tests for -n -h -d option pr: Add test for -h option pr: Add test for -d option --- src/pr/pr.rs | 44 +++- tests/fixtures/pr/test_num_page.log | 112 ++++++++++ tests/fixtures/pr/test_num_page.log.expected | 132 ++++++++++++ .../fixtures/pr/test_num_page_2.log.expected | 132 ++++++++++++ .../pr/test_num_page_less_content.log | 7 + .../test_num_page_less_content.log.expected | 19 ++ .../pr/test_one_page_double_line.log.expected | 204 ++++++++++++++++++ .../pr/test_one_page_header.log.expected | 66 ++++++ tests/test_pr.rs | 101 ++++++++- 9 files changed, 808 insertions(+), 9 deletions(-) create mode 100644 tests/fixtures/pr/test_num_page.log create mode 100644 tests/fixtures/pr/test_num_page.log.expected create mode 100644 tests/fixtures/pr/test_num_page_2.log.expected create mode 100644 tests/fixtures/pr/test_num_page_less_content.log create mode 100644 tests/fixtures/pr/test_num_page_less_content.log.expected create mode 100644 tests/fixtures/pr/test_one_page_double_line.log.expected create mode 100644 tests/fixtures/pr/test_one_page_header.log.expected diff --git a/src/pr/pr.rs b/src/pr/pr.rs index a6636eaa7..20db63d1b 100644 --- a/src/pr/pr.rs +++ b/src/pr/pr.rs @@ -158,19 +158,23 @@ quick_error! { pub fn uumain(args: Vec) -> i32 { let mut opts = getopts::Options::new(); - opts.optflagopt( + opts.opt( "", PAGE_RANGE_OPTION, "Begin and stop printing with page FIRST_PAGE[:LAST_PAGE]", "FIRST_PAGE[:LAST_PAGE]", + HasArg::Yes, + Occur::Optional, ); - opts.optopt( + opts.opt( STRING_HEADER_OPTION, "header", "Use the string header to replace the file name \ in the header line.", "STRING", + HasArg::Yes, + Occur::Optional, ); opts.opt( @@ -183,14 +187,16 @@ pub fn uumain(args: Vec) -> i32 { Occur::Optional, ); - opts.optflagopt( + opts.opt( NUMBERING_MODE_OPTION, - "", + "--number-lines", "Provide width digit line numbering. The default for width, if not specified, is 5. The number occupies the first width column positions of each text column or each line of -m output. If char (any nondigit character) is given, it is appended to the line number to separate it from whatever follows. The default for char is a . Line numbers longer than width columns are truncated.", "[char][width]", + HasArg::Maybe, + Occur::Optional, ); opts.opt( @@ -271,10 +277,22 @@ pub fn uumain(args: Vec) -> i32 { let mut files: Vec = matches.free.clone(); if files.is_empty() { - //For stdin - files.push(FILE_STDIN.to_owned()); + // -n value is optional if -n is given the opts gets confused + if matches.opt_present(NUMBERING_MODE_OPTION) { + let is_afile = is_a_file(&matches, &mut files); + if is_afile.is_err() { + writeln!(&mut stderr(), "{}", is_afile.err().unwrap()); + return 1; + } else { + files.push(is_afile.unwrap()); + } + } else { + //For stdin + files.push(FILE_STDIN.to_owned()); + } } + if matches.opt_present("help") { return print_usage(&mut opts, &matches); } @@ -302,6 +320,14 @@ pub fn uumain(args: Vec) -> i32 { return 0; } +fn is_a_file(matches: &Matches, files: &mut Vec) -> Result { + let could_be_file = matches.opt_str(NUMBERING_MODE_OPTION).unwrap(); + match File::open(&could_be_file) { + Ok(f) => Ok(could_be_file), + Err(e) => Err(PrError::NotExists(could_be_file)) + } +} + fn print_usage(opts: &mut Options, matches: &Matches) -> i32 { println!("{} {} -- print files", NAME, VERSION); println!(); @@ -573,11 +599,15 @@ fn write_columns(lines: &Vec, options: &OutputOptions, out: &mut Stdout, let mut i = 0; let is_number_mode = options.number.is_some(); + for start in 0..content_lines_per_page { let indexes: Vec = get_indexes(start, content_lines_per_page, columns); let mut line = String::new(); for index in indexes { - let read_line: &String = lines.get(index).unwrap_or(&blank_line); + if lines.get(index).is_none() { + break; + } + let read_line = lines.get(index).unwrap(); let next_line_number = line_number + index + 1; let trimmed_line = get_line_for_printing( next_line_number, &width, diff --git a/tests/fixtures/pr/test_num_page.log b/tests/fixtures/pr/test_num_page.log new file mode 100644 index 000000000..da467dce2 --- /dev/null +++ b/tests/fixtures/pr/test_num_page.log @@ -0,0 +1,112 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed diff --git a/tests/fixtures/pr/test_num_page.log.expected b/tests/fixtures/pr/test_num_page.log.expected new file mode 100644 index 000000000..076d3f212 --- /dev/null +++ b/tests/fixtures/pr/test_num_page.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} test_num_page.log Page 1 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 12 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 15 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 18 Mon Dec 10 11:42:57.449 Info: 802.1X changed + 19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 21 Mon Dec 10 11:42:57.600 Info: 802.1X changed + 22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 26 Mon Dec 10 11:42:57.749 Info: 802.1X changed + 27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 29 Mon Dec 10 11:42:57.896 Info: 802.1X changed + 30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 32 Mon Dec 10 11:42:58.045 Info: 802.1X changed + 33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 35 Mon Dec 10 11:42:58.193 Info: 802.1X changed + 36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 38 Mon Dec 10 11:42:58.342 Info: 802.1X changed + 39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 41 Mon Dec 10 11:42:58.491 Info: 802.1X changed + 42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 44 Mon Dec 10 11:42:58.640 Info: 802.1X changed + 45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 47 Mon Dec 10 11:42:58.805 Info: 802.1X changed + 48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 50 Mon Dec 10 11:42:58.958 Info: 802.1X changed + 51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 53 Mon Dec 10 11:42:59.155 Info: 802.1X changed + 54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 56 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test_num_page.log Page 2 + + + 57 ntation processAirPortStateChanges]: pppConnectionState 0 + 58 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 59 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 60 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 61 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 62 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 63 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 64 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 65 Mon Dec 10 11:42:57.002 Info: 802.1X changed + 66 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 67 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 68 Mon Dec 10 11:42:57.152 Info: 802.1X changed + 69 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 70 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 71 Mon Dec 10 11:42:57.302 Info: 802.1X changed + 72 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 73 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 74 Mon Dec 10 11:42:57.449 Info: 802.1X changed + 75 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 76 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 77 Mon Dec 10 11:42:57.600 Info: 802.1X changed + 78 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 79 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 80 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 81 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 82 Mon Dec 10 11:42:57.749 Info: 802.1X changed + 83 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 84 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 85 Mon Dec 10 11:42:57.896 Info: 802.1X changed + 86 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 87 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 88 Mon Dec 10 11:42:58.045 Info: 802.1X changed + 89 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 90 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 91 Mon Dec 10 11:42:58.193 Info: 802.1X changed + 92 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 93 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 94 Mon Dec 10 11:42:58.342 Info: 802.1X changed + 95 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 96 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 97 Mon Dec 10 11:42:58.491 Info: 802.1X changed + 98 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 99 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 100 Mon Dec 10 11:42:58.640 Info: 802.1X changed + 101 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 102 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 103 Mon Dec 10 11:42:58.805 Info: 802.1X changed + 104 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 105 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 106 Mon Dec 10 11:42:58.958 Info: 802.1X changed + 107 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 108 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 109 Mon Dec 10 11:42:59.155 Info: 802.1X changed + 110 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 111 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 112 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/fixtures/pr/test_num_page_2.log.expected b/tests/fixtures/pr/test_num_page_2.log.expected new file mode 100644 index 000000000..dae437ef8 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_2.log.expected @@ -0,0 +1,132 @@ + + +{last_modified_time} test_num_page.log Page 1 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 8 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 9 Mon Dec 10 11:42:57.002 Info: 802.1X changed +10 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +11 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +12 Mon Dec 10 11:42:57.152 Info: 802.1X changed +13 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +14 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +15 Mon Dec 10 11:42:57.302 Info: 802.1X changed +16 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +17 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +18 Mon Dec 10 11:42:57.449 Info: 802.1X changed +19 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +20 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +21 Mon Dec 10 11:42:57.600 Info: 802.1X changed +22 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +23 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +24 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +25 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +26 Mon Dec 10 11:42:57.749 Info: 802.1X changed +27 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +28 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +29 Mon Dec 10 11:42:57.896 Info: 802.1X changed +30 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +31 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +32 Mon Dec 10 11:42:58.045 Info: 802.1X changed +33 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +34 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +35 Mon Dec 10 11:42:58.193 Info: 802.1X changed +36 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +37 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +38 Mon Dec 10 11:42:58.342 Info: 802.1X changed +39 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +40 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +41 Mon Dec 10 11:42:58.491 Info: 802.1X changed +42 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +43 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +44 Mon Dec 10 11:42:58.640 Info: 802.1X changed +45 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +46 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +47 Mon Dec 10 11:42:58.805 Info: 802.1X changed +48 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +49 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +50 Mon Dec 10 11:42:58.958 Info: 802.1X changed +51 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +52 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +53 Mon Dec 10 11:42:59.155 Info: 802.1X changed +54 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +55 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +56 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + +{last_modified_time} test_num_page.log Page 2 + + +57 ntation processAirPortStateChanges]: pppConnectionState 0 +58 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +59 Mon Dec 10 11:42:56.705 Info: 802.1X changed +60 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +61 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +62 Mon Dec 10 11:42:56.854 Info: 802.1X changed +63 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +64 Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +65 Mon Dec 10 11:42:57.002 Info: 802.1X changed +66 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +67 Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +68 Mon Dec 10 11:42:57.152 Info: 802.1X changed +69 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +70 Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +71 Mon Dec 10 11:42:57.302 Info: 802.1X changed +72 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +73 Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +74 Mon Dec 10 11:42:57.449 Info: 802.1X changed +75 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +76 Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +77 Mon Dec 10 11:42:57.600 Info: 802.1X changed +78 Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +79 Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +80 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +81 Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +82 Mon Dec 10 11:42:57.749 Info: 802.1X changed +83 Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +84 Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +85 Mon Dec 10 11:42:57.896 Info: 802.1X changed +86 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +87 Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +88 Mon Dec 10 11:42:58.045 Info: 802.1X changed +89 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +90 Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +91 Mon Dec 10 11:42:58.193 Info: 802.1X changed +92 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +93 Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +94 Mon Dec 10 11:42:58.342 Info: 802.1X changed +95 Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +96 Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +97 Mon Dec 10 11:42:58.491 Info: 802.1X changed +98 Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +99 Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +00 Mon Dec 10 11:42:58.640 Info: 802.1X changed +01 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +02 Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +03 Mon Dec 10 11:42:58.805 Info: 802.1X changed +04 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +05 Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +06 Mon Dec 10 11:42:58.958 Info: 802.1X changed +07 Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +08 Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +09 Mon Dec 10 11:42:59.155 Info: 802.1X changed +10 Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +11 Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +12 Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/fixtures/pr/test_num_page_less_content.log b/tests/fixtures/pr/test_num_page_less_content.log new file mode 100644 index 000000000..cf13a6862 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_less_content.log @@ -0,0 +1,7 @@ +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 \ No newline at end of file diff --git a/tests/fixtures/pr/test_num_page_less_content.log.expected b/tests/fixtures/pr/test_num_page_less_content.log.expected new file mode 100644 index 000000000..a3c733e01 --- /dev/null +++ b/tests/fixtures/pr/test_num_page_less_content.log.expected @@ -0,0 +1,19 @@ + + +{last_modified_time} test_num_page_less_content.log Page 1 + + + 1 ntation processAirPortStateChanges]: pppConnectionState 0 + 2 Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 3 Mon Dec 10 11:42:56.705 Info: 802.1X changed + 4 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + 5 Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + 6 Mon Dec 10 11:42:56.854 Info: 802.1X changed + 7 Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + + + + + + + diff --git a/tests/fixtures/pr/test_one_page_double_line.log.expected b/tests/fixtures/pr/test_one_page_double_line.log.expected new file mode 100644 index 000000000..831570103 --- /dev/null +++ b/tests/fixtures/pr/test_one_page_double_line.log.expected @@ -0,0 +1,204 @@ + + + + +{last_modified_time} test_one_page.log Page 1 + + + + + +ntation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:56.705 Info: 802.1X changed + +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:56.854 Info: 802.1X changed + +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.002 Info: 802.1X changed + +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.152 Info: 802.1X changed + +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.302 Info: 802.1X changed + +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.449 Info: 802.1X changed + +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.600 Info: 802.1X changed + +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:57.749 Info: 802.1X changed + +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{last_modified_time} test_one_page.log Page 2 + + + + + +Mon Dec 10 11:42:57.896 Info: 802.1X changed + +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.045 Info: 802.1X changed + +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.193 Info: 802.1X changed + +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.342 Info: 802.1X changed + +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.491 Info: 802.1X changed + +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.640 Info: 802.1X changed + +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.805 Info: 802.1X changed + +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:58.958 Info: 802.1X changed + +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:59.155 Info: 802.1X changed + +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 + +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars + +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/fixtures/pr/test_one_page_header.log.expected b/tests/fixtures/pr/test_one_page_header.log.expected new file mode 100644 index 000000000..a00d5f855 --- /dev/null +++ b/tests/fixtures/pr/test_one_page_header.log.expected @@ -0,0 +1,66 @@ + + +{last_modified_time} {header} Page 1 + + +ntation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.558 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.705 Info: 802.1X changed +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.706 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:56.854 Info: 802.1X changed +Mon Dec 10 11:42:56.855 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:56.856 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.002 Info: 802.1X changed +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.003 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.152 Info: 802.1X changed +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.154 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.302 Info: 802.1X changed +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.304 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.449 Info: 802.1X changed +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.451 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.600 Info: 802.1X changed +Mon Dec 10 11:42:57.601 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.602 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.624 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.749 Info: 802.1X changed +Mon Dec 10 11:42:57.750 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.751 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:57.896 Info: 802.1X changed +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:57.897 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.045 Info: 802.1X changed +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.047 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.193 Info: 802.1X changed +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.195 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.342 Info: 802.1X changed +Mon Dec 10 11:42:58.343 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.344 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.491 Info: 802.1X changed +Mon Dec 10 11:42:58.493 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.494 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.640 Info: 802.1X changed +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.642 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.805 Info: 802.1X changed +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.806 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:58.958 Info: 802.1X changed +Mon Dec 10 11:42:58.959 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:58.960 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.155 Info: 802.1X changed +Mon Dec 10 11:42:59.157 Info: -[AirPortExtraImplementation processAirPortStateChanges]: pppConnectionState 0 +Mon Dec 10 11:42:59.159 Info: -[AirPortExtraImplementation processAirPortStateChanges]: old state=4 bars, new state=4 bars +Mon Dec 10 11:42:59.352 Info: 802.1X changed + + + + + diff --git a/tests/test_pr.rs b/tests/test_pr.rs index 5e839bc3a..bb068181d 100644 --- a/tests/test_pr.rs +++ b/tests/test_pr.rs @@ -20,10 +20,107 @@ fn file_last_modified_time(ucmd: &UCommand, path: &str) -> String { #[test] fn test_without_any_options() { let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page.log.expected"; let mut scenario = new_ucmd!(); let value = file_last_modified_time(&scenario, test_file_path); scenario - .args(&["test_one_page.log"]) + .args(&[test_file_path]) .succeeds() - .stdout_is_templated_fixture("test_one_page.log.expected", vec![("{last_modified_time}".to_string(), value)]); + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_numbering_option() { + let test_file_path = "test_num_page.log"; + let expected_test_file_path = "test_num_page.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_numbering_option_when_content_is_less_than_page() { + let test_file_path = "test_num_page_less_content.log"; + let expected_test_file_path = "test_num_page_less_content.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-n", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_numbering_option_with_number_width() { + let test_file_path = "test_num_page.log"; + let expected_test_file_path = "test_num_page_2.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-n", "2", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![("{last_modified_time}".to_string(), value)]); +} + +#[test] +fn test_with_header_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_header.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + let header = "new file"; + scenario + .args(&["-h", header, test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ("{header}".to_string(), header.to_string()) + ]); +} + +#[test] +fn test_with_long_header_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_header.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + let header = "new file"; + scenario + .args(&["--header=new file", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ("{header}".to_string(), header.to_string()) + ]); +} + +#[test] +fn test_with_double_space_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_double_line.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["-d", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); +} + +#[test] +fn test_with_long_double_space_option() { + let test_file_path = "test_one_page.log"; + let expected_test_file_path = "test_one_page_double_line.log.expected"; + let mut scenario = new_ucmd!(); + let value = file_last_modified_time(&scenario, test_file_path); + scenario + .args(&["--double-space", test_file_path]) + .succeeds() + .stdout_is_templated_fixture(expected_test_file_path, vec![ + ("{last_modified_time}".to_string(), value), + ]); } \ No newline at end of file