Skip to content

Commit

Permalink
test: updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinFillon committed Feb 16, 2024
1 parent 429d3b6 commit 06d4775
Show file tree
Hide file tree
Showing 185 changed files with 176 additions and 406 deletions.
25 changes: 21 additions & 4 deletions src/options/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,28 @@ impl TypedValueParser for TimeFormatParser {
// - there is nothing after `+`
// line 1 will be empty when:
// - `+` is followed immediately by `\n`
let empty_non_recent_format_msg = "Custom timestamp format is empty, \
please supply a chrono format string after the plus sign.";
let non_recent = lines.next().expect(empty_non_recent_format_msg);
let non_recent = match lines.next() {
Some(s) => s,
None => {
return Err(Error::raw(
clap::error::ErrorKind::InvalidValue,
format!(
"Invalid custom timestamp format: {fmt}.\n\
Please start the format with a plus sign (+) to indicate a custom format.\n\
For example: +\"%Y-%m-%d %H:%M:%S\"",
),
))
}
};
let non_recent = if non_recent.is_empty() {
panic!("{}", empty_non_recent_format_msg)
return Err(Error::raw(
clap::error::ErrorKind::InvalidValue,
format!(
"Invalid custom timestamp format: {fmt}.\n\
Please start the format with a plus sign (+) to indicate a custom format.\n\
For example: +\"%Y-%m-%d %H:%M:%S\"",
),
));
} else {
non_recent
};
Expand Down
Empty file.
8 changes: 0 additions & 8 deletions tests/gen/basic_complex_names_nix.stdout

This file was deleted.

1 change: 0 additions & 1 deletion tests/gen/long_all_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_binary_bytes_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- complex-names
- git
- grid
- group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_blocksize_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - - nixbld 1 Jan 1970 git
drwxr-xr-x - - nixbld 1 Jan 1970 grid
drwxr-xr-x - - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_extended_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_file_size_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
- complex-names
- git
- grid
- group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_git_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_git_repos_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_git_repos_no_status_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_grid_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_header_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Permissions Size User Date Modified Name
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_header_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Size Name
- complex-names
- git
- grid
- group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_icons_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
10 changes: 0 additions & 10 deletions tests/gen/long_links_recurse_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
3 complex-names
12 git
1002 grid
2 group
Expand All @@ -9,15 +8,6 @@
3 symlinks
2 time

tests/test_dir/complex-names:
1 'a looooooooooooooooooong filename'
1 'another one long name'
2 double-quotes

tests/test_dir/complex-names/double-quotes:
1 "'Obi wan kanobi'"
1 "hello there"

tests/test_dir/git:
3 001
3 002
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_octal_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
0755 drwxr-xr-x - nixbld 1 Jan 1970 complex-names
0755 drwxr-xr-x - nixbld 1 Jan 1970 git
0755 drwxr-xr-x - nixbld 1 Jan 1970 grid
0755 drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_recurse_with_level_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
6 changes: 4 additions & 2 deletions tests/gen/long_time_style_custom_non_recent_empty_nix.stderr
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
thread 'main' panicked at 'Custom timestamp format is empty, please supply a chrono format string after the plus sign.', src/options/view.rs:349:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Invalid custom timestamp format: +
.
Please start the format with a plus sign (+) to indicate a custom format.
For example: +"%Y-%m-%d %H:%M:%S"
2 changes: 1 addition & 1 deletion tests/gen/long_time_style_custom_non_recent_empty_nix.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bin.name = "eza"
args = "tests/timestamp_test_dir --long --no-permissions --no-filesize --no-user --sort=modified --time-style='+\n'"
status.code = 101
status.code = 2
5 changes: 3 additions & 2 deletions tests/gen/long_time_style_custom_non_recent_none_nix.stderr
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
thread 'main' panicked at 'Custom timestamp format is empty, please supply a chrono format string after the plus sign.', src/options/view.rs:347:47
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Invalid custom timestamp format: +.
Please start the format with a plus sign (+) to indicate a custom format.
For example: +"%Y-%m-%d %H:%M:%S"
2 changes: 1 addition & 1 deletion tests/gen/long_time_style_custom_non_recent_none_nix.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
bin.name = "eza"
args = "tests/timestamp_test_dir --long --no-permissions --no-filesize --no-user --sort=modified --time-style='+'"
status.code = 101
status.code = 2
2 changes: 1 addition & 1 deletion tests/gen/long_time_style_custom_recent_empty_nix.stderr
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
thread 'main' panicked at 'Custom timestamp format for recent files is empty, please supply a chrono format string at the second line.', src/options/view.rs:363:25
thread 'main' panicked at 'Custom timestamp format for recent files is empty, please supply a chrono format string at the second line.', src/options/parser.rs:328:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
1 change: 0 additions & 1 deletion tests/gen/long_time_style_relative_nix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 54 years complex-names
drwxr-xr-x - nixbld 54 years git
drwxr-xr-x - nixbld 54 years grid
drwxr-xr-x - nixbld 54 years group
Expand Down
1 change: 0 additions & 1 deletion tests/gen/long_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
6 changes: 0 additions & 6 deletions tests/gen/only_dir_recursive_long_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand All @@ -9,11 +8,6 @@ specials
symlinks
time

tests/test_dir/complex-names:
double-quotes

tests/test_dir/complex-names/double-quotes:

tests/test_dir/git:
001
002
Expand Down
6 changes: 0 additions & 6 deletions tests/gen/only_dir_recursive_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand All @@ -9,11 +8,6 @@ specials
symlinks
time

tests/test_dir/complex-names:
double-quotes

tests/test_dir/complex-names/double-quotes:

tests/test_dir/git:
001
002
Expand Down
1 change: 0 additions & 1 deletion tests/gen/only_dir_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
10 changes: 0 additions & 10 deletions tests/gen/recursive_long_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand All @@ -9,15 +8,6 @@ specials
symlinks
time

tests/test_dir/complex-names:
'a looooooooooooooooooong filename'
'another one long name'
double-quotes

tests/test_dir/complex-names/double-quotes:
"'Obi wan kanobi'"
"hello there"

tests/test_dir/git:
001
002
Expand Down
10 changes: 0 additions & 10 deletions tests/gen/recursive_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand All @@ -9,15 +8,6 @@ specials
symlinks
time

tests/test_dir/complex-names:
'a looooooooooooooooooong filename'
'another one long name'
double-quotes

tests/test_dir/complex-names/double-quotes:
"'Obi wan kanobi'"
"hello there"

tests/test_dir/git:
001
002
Expand Down
6 changes: 0 additions & 6 deletions tests/gen/tree_long_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
tests/test_dir
├── complex-names
│ ├── 'a looooooooooooooooooong filename'
│ ├── 'another one long name'
│ └── double-quotes
│ ├── ''Obi wan kanobi''
│ └── 'hello there'
├── git
│ ├── 001
│ │ ├── file_000
Expand Down
6 changes: 0 additions & 6 deletions tests/gen/tree_unix.stdout
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
tests/test_dir
├── complex-names
│ ├── 'a looooooooooooooooooong filename'
│ ├── 'another one long name'
│ └── double-quotes
│ ├── ''Obi wan kanobi''
│ └── 'hello there'
├── git
│ ├── 001
│ │ ├── file_000
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_10c50228fc1c6107.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
1 change: 0 additions & 1 deletion tests/ptests/ptest_1128756497bbcbce.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_13234446d830648.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_132ac9f159c3473e.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
1 change: 0 additions & 1 deletion tests/ptests/ptest_13c76530584f9804.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_14c5df14f800bc28.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_182085f8602ed2aa.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 git
drwxr-xr-x - nixbld 1 Jan 1970 grid
drwxr-xr-x - nixbld 1 Jan 1970 group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_1889daad10054484.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_19cf21a43f373b6.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_1a3b7e2197b9241c.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_1ab8279d631495b0.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
1 change: 0 additions & 1 deletion tests/ptests/ptest_1c990fbac951fdaf.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
1 change: 0 additions & 1 deletion tests/ptests/ptest_1e61d8c305ff6c48.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 icons
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
1 change: 0 additions & 1 deletion tests/ptests/ptest_1ec7257c14635d03.stdout
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
complex-names
git
grid
group
Expand Down
2 changes: 1 addition & 1 deletion tests/ptests/ptest_2092f19a0d4ea1a2.stdout
Original file line number Diff line number Diff line change
@@ -1 +1 @@
complex-names git grid group icons perms size specials symlinks time
git grid group icons perms size specials symlinks time
1 change: 0 additions & 1 deletion tests/ptests/ptest_2176b1b061cb7da2.stdout
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
drwxr-xr-x - nixbld 1 Jan 1970 specials
drwxr-xr-x - nixbld 1 Jan 1970 group
drwxr-xr-x - nixbld 1 Jan 1970 perms
drwxr-xr-x - nixbld 1 Jan 1970 complex-names
drwxr-xr-x - nixbld 1 Jan 1970 size
drwxr-xr-x - nixbld 1 Jan 1970 time
drwxr-xr-x - nixbld 1 Jan 1970 symlinks
Expand Down
Loading

0 comments on commit 06d4775

Please sign in to comment.