42 Commits

Author SHA1 Message Date
Sylvestre Ledru c6a8a799d3 New release (0.4.2) 2023-07-23 19:17:55 +02:00
Sylvestre Ledru 7e98dbcf03 Merge pull request #267 from sylvestre/ci
CI: test all features
2023-07-23 16:07:47 +02:00
Sylvestre Ledru a53099b8f1 CI: test all features 2023-07-23 15:53:45 +02:00
Sylvestre Ledru b5f2d3a8cf Merge pull request #265 from sylvestre/uucore
move to uucore 0.0.20
2023-07-23 13:01:10 +02:00
Sylvestre Ledru a5f720874a rustfmt the recent change 2023-07-23 12:53:50 +02:00
Sylvestre Ledru 329a4fd622 move to uucore 0.0.20 2023-07-23 10:42:05 +02:00
Sylvestre Ledru c4f7872cab Merge pull request #264 from sylvestre/travis
Remove the travis configuration as we don't use it
2023-07-23 10:26:16 +02:00
Sylvestre Ledru 67f56fea8c Remove the travis configuration as we don't use it 2023-07-23 10:05:27 +02:00
Sylvestre Ledru 27bf2d2d26 Merge pull request #263 from sylvestre/appveyor
Remove appveyor configuration
2023-07-23 09:40:43 +02:00
Sylvestre Ledru c55e2caade Merge pull request #245 from uutils/dependabot/cargo/predicates-3.0.3
build(deps): bump predicates from 3.0.2 to 3.0.3
2023-07-23 08:47:37 +02:00
Sylvestre Ledru 55dad3745e Merge pull request #249 from uutils/dependabot/cargo/chrono-0.4.26
build(deps): bump chrono from 0.4.24 to 0.4.26
2023-07-23 08:47:21 +02:00
Sylvestre Ledru 249b6eedcf Remove appveyor configuration 2023-07-23 08:46:46 +02:00
Sylvestre Ledru c464e8ff1f Merge pull request #250 from uutils/dependabot/cargo/once_cell-1.18.0
build(deps): bump once_cell from 1.17.1 to 1.18.0
2023-07-23 08:45:50 +02:00
dependabot[bot] fa976740e9 build(deps): bump chrono from 0.4.24 to 0.4.26
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.24 to 0.4.26.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.24...v0.4.26)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-07-12 11:52:30 +00:00
Sylvestre Ledru 13b4ae4d45 bump the version 2023-07-12 13:51:37 +02:00
dependabot[bot] 1cbc975b33 build(deps): bump once_cell from 1.17.1 to 1.18.0
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.17.1 to 1.18.0.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.17.1...v1.18.0)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-13 03:57:30 +00:00
Sylvestre Ledru 6a034e28e8 Merge pull request #248 from uutils/dependabot/cargo/tempfile-3.6.0
build(deps): bump tempfile from 3.4.0 to 3.6.0
2023-06-12 08:49:00 +02:00
dependabot[bot] abdd86c63d build(deps): bump predicates from 3.0.2 to 3.0.3
Bumps [predicates](https://github.com/assert-rs/predicates-rs) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/assert-rs/predicates-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/predicates-rs/compare/v3.0.2...v3.0.3)

---
updated-dependencies:
- dependency-name: predicates
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 06:48:39 +00:00
Sylvestre Ledru eb6322df5f Merge pull request #247 from uutils/dependabot/cargo/assert_cmd-2.0.11
build(deps): bump assert_cmd from 2.0.10 to 2.0.11
2023-06-12 08:48:06 +02:00
dependabot[bot] cd44d01d57 build(deps): bump tempfile from 3.4.0 to 3.6.0
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.4.0 to 3.6.0.
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.4.0...v3.6.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 03:58:57 +00:00
dependabot[bot] bda32f0482 build(deps): bump assert_cmd from 2.0.10 to 2.0.11
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.10 to 2.0.11.
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/assert_cmd/compare/v2.0.10...v2.0.11)

---
updated-dependencies:
- dependency-name: assert_cmd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-12 03:58:42 +00:00
Sylvestre Ledru eed9b64aaf Merge pull request #230 from uutils/dependabot/cargo/serial_test-2.0.0
build(deps): bump serial_test from 1.0.0 to 2.0.0
2023-06-09 11:01:23 +02:00
Sylvestre Ledru ed3a62e9d7 Merge pull request #232 from uutils/dependabot/cargo/walkdir-2.3.3
build(deps): bump walkdir from 2.3.2 to 2.3.3
2023-06-09 11:01:07 +02:00
dependabot[bot] 1488d55ceb build(deps): bump serial_test from 1.0.0 to 2.0.0
Bumps [serial_test](https://github.com/palfrey/serial_test) from 1.0.0 to 2.0.0.
- [Release notes](https://github.com/palfrey/serial_test/releases)
- [Commits](https://github.com/palfrey/serial_test/compare/v1.0.0...v2.0.0)

---
updated-dependencies:
- dependency-name: serial_test
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-09 08:34:11 +00:00
dependabot[bot] 61f2ffe803 build(deps): bump walkdir from 2.3.2 to 2.3.3
Bumps [walkdir](https://github.com/BurntSushi/walkdir) from 2.3.2 to 2.3.3.
- [Release notes](https://github.com/BurntSushi/walkdir/releases)
- [Commits](https://github.com/BurntSushi/walkdir/compare/2.3.2...2.3.3)

---
updated-dependencies:
- dependency-name: walkdir
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-09 08:34:05 +00:00
Sylvestre Ledru efdf1f17c7 Merge pull request #234 from uutils/dependabot/cargo/filetime-0.2.21
build(deps): bump filetime from 0.2.20 to 0.2.21
2023-06-09 10:33:22 +02:00
Shiv 6be2cd4c2c Refactor code to use String::new (#237)
* Refactor code to use String::new instead of manually creating an empty string

* Refactor code to use String::new instead of manually creating an empty string

---------

Co-authored-by: HelloShiv <swagatswarooparida@gmail.com>
2023-04-15 22:58:05 +02:00
Shiv a1ae326e72 replaced not equal operation with equality operator (#235)
* replaced not equal operation with equality operator

---------

Co-authored-by: HelloShiv <swagatswarooparida@gmail.com>
2023-04-10 21:08:32 +02:00
dependabot[bot] 61002aec2b build(deps): bump filetime from 0.2.20 to 0.2.21
Bumps [filetime](https://github.com/alexcrichton/filetime) from 0.2.20 to 0.2.21.
- [Release notes](https://github.com/alexcrichton/filetime/releases)
- [Commits](https://github.com/alexcrichton/filetime/compare/0.2.20...0.2.21)

---
updated-dependencies:
- dependency-name: filetime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-10 03:16:56 +00:00
Sylvestre Ledru 225f77f7ff Merge pull request #208 from uutils/dependabot/cargo/filetime-0.2.20
build(deps): bump filetime from 0.2.19 to 0.2.20
2023-04-07 09:46:13 +02:00
dependabot[bot] 0ebefda3a8 build(deps): bump filetime from 0.2.19 to 0.2.20
Bumps [filetime](https://github.com/alexcrichton/filetime) from 0.2.19 to 0.2.20.
- [Release notes](https://github.com/alexcrichton/filetime/releases)
- [Commits](https://github.com/alexcrichton/filetime/compare/0.2.19...0.2.20)

---
updated-dependencies:
- dependency-name: filetime
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-07 08:57:25 +02:00
Sylvestre Ledru 91a6e64c9f Merge pull request #214 from uutils/dependabot/cargo/tempfile-3.4.0
build(deps): bump tempfile from 3.3.0 to 3.4.0
2023-04-07 08:57:14 +02:00
Sylvestre Ledru f36f576fd9 Merge pull request #215 from uutils/dependabot/cargo/chrono-0.4.24
build(deps): bump chrono from 0.4.23 to 0.4.24
2023-04-07 08:57:03 +02:00
Sylvestre Ledru a5db23c712 Merge pull request #218 from uutils/dependabot/cargo/assert_cmd-2.0.10
build(deps): bump assert_cmd from 2.0.8 to 2.0.10
2023-04-07 08:56:48 +02:00
Sylvestre Ledru 04dad0ba5f Merge pull request #228 from uutils/dependabot/cargo/regex-1.7.3
build(deps): bump regex from 1.7.1 to 1.7.3
2023-04-07 08:56:35 +02:00
Shiv 2011a7adfa implemented assert! for resolving warning panic! (#227)
* implemented assert! for resolving warning panic!
2023-04-07 08:56:17 +02:00
Sylvestre Ledru 1753e032b2 Merge pull request #229 from jayvdb/spelling
Fix spelling
2023-04-07 08:11:08 +02:00
John Vandenberg 6be211a336 Fix spelling 2023-04-07 13:21:50 +08:00
dependabot[bot] dbc2f2729b build(deps): bump regex from 1.7.1 to 1.7.3
Bumps [regex](https://github.com/rust-lang/regex) from 1.7.1 to 1.7.3.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.7.1...1.7.3)

---
updated-dependencies:
- dependency-name: regex
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-03 03:59:34 +00:00
dependabot[bot] 828a72a1ba build(deps): bump assert_cmd from 2.0.8 to 2.0.10
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.8 to 2.0.10.
- [Release notes](https://github.com/assert-rs/assert_cmd/releases)
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/assert_cmd/compare/v2.0.8...v2.0.10)

---
updated-dependencies:
- dependency-name: assert_cmd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-02 17:22:51 +00:00
dependabot[bot] bcc4e0b099 build(deps): bump chrono from 0.4.23 to 0.4.24
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.23 to 0.4.24.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.23...v0.4.24)

---
updated-dependencies:
- dependency-name: chrono
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-02 17:22:48 +00:00
dependabot[bot] c6e025f19a build(deps): bump tempfile from 3.3.0 to 3.4.0
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.3.0 to 3.4.0.
- [Release notes](https://github.com/Stebalien/tempfile/releases)
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS)
- [Commits](https://github.com/Stebalien/tempfile/commits)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-02 18:48:06 +02:00
17 changed files with 717 additions and 314 deletions
-23
View File
@@ -1,23 +0,0 @@
os: Visual Studio 2015
version: "{build}"
environment:
matrix:
- channel: stable
target: x86_64-pc-windows-msvc
- channel: nightly
target: x86_64-pc-windows-msvc
install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init -yv --default-toolchain %channel% --default-host %target%
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
- rustc -vV && cargo -vV
build_script:
- cargo build --verbose
test_script:
- cargo test --verbose
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
- name: Check
run: |
cargo check
cargo check --all --all-features
test:
name: cargo test
-33
View File
@@ -1,33 +0,0 @@
language: rust
sudo: false
os:
- linux
- osx
rust:
- stable
- nightly
matrix:
fast_finish: true
branches:
only:
- master
cache: cargo
before_cache: |
if [[ "$TRAVIS_RUST_VERSION" = nightly ]]; then
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin -f
fi
script:
- cargo build --verbose
- cargo test --verbose
after_script: |
if [[ "$TRAVIS_OS_NAME" = linux && "$TRAVIS_RUST_VERSION" = nightly ]]; then
cargo tarpaulin --out Xml
bash <(curl -s https://codecov.io/bash)
fi
Generated
+576 -167
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -1,6 +1,6 @@
[package]
name = "findutils"
version = "0.4.0"
version = "0.4.2"
homepage = "https://github.com/uutils/findutils"
repository = "https://github.com/uutils/findutils"
edition = "2018"
@@ -15,16 +15,16 @@ clap = "2.34"
faccess = "0.2.4"
walkdir = "2.3"
regex = "1.7"
once_cell = "1.17"
once_cell = "1.18"
onig = "6.4"
uucore = { version = "0.0.12", features = ["entries", "fs", "fsext", "mode"] }
uucore = { version = "0.0.20", features = ["entries", "fs", "fsext", "mode"] }
[dev-dependencies]
assert_cmd = "2"
filetime = "0.2"
nix = "0.26"
predicates = "3"
serial_test = "1.0"
serial_test = "2.0"
tempfile = "3"
[[bin]]
+1 -1
View File
@@ -169,7 +169,7 @@ impl Pattern {
Self { regex }
}
/// Test if this patern matches a string.
/// Test if this pattern matches a string.
pub fn matches(&self, string: &str) -> bool {
self.regex.is_match(string)
}
+10 -6
View File
@@ -73,15 +73,19 @@ mod tests {
fn create_file_link() {
#[cfg(unix)]
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
#[cfg(windows)]
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
}
+2 -2
View File
@@ -530,9 +530,9 @@ mod tests {
#[test]
fn not_has_side_effects_works() {
let has_fx = NotMatcher::new(HasSideEffects);
let hasnt_fx = NotMatcher::new(FalseMatcher);
let has_no_fx = NotMatcher::new(FalseMatcher);
assert!(has_fx.has_side_effects());
assert!(!hasnt_fx.has_side_effects());
assert!(!has_no_fx.has_side_effects());
}
#[test]
+3 -2
View File
@@ -611,7 +611,7 @@ mod tests {
let deps = FakeDependencies::new();
let matcher =
build_top_level_matcher(&[arg, "-name", "doesntexist"], &mut config).unwrap();
build_top_level_matcher(&[arg, "-name", "does_not_exist"], &mut config).unwrap();
assert!(matcher.matches(&abbbc_lower, &mut deps.new_matcher_io()));
assert_eq!(
@@ -652,7 +652,8 @@ mod tests {
config = Config::default();
let matcher =
build_top_level_matcher(&[arg, arg, "-name", "doesntexist"], &mut config).unwrap();
build_top_level_matcher(&[arg, arg, "-name", "does_not_exist"], &mut config)
.unwrap();
assert!(!matcher.matches(&abbbc_lower, &mut deps.new_matcher_io()));
}
+10 -6
View File
@@ -47,15 +47,19 @@ mod tests {
fn create_file_link() {
#[cfg(unix)]
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
#[cfg(windows)]
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
}
+1 -1
View File
@@ -223,7 +223,7 @@ mod tests {
PermMatcher::new("d=rwx,g=rx,o+r").expect_err("invalid category should fail");
PermMatcher::new("u=dwx,g=rx,o+r").expect_err("invalid permission bit should fail");
PermMatcher::new("u_rwx,g=rx,o+r")
.expect_err("invalid category/permissoin separator should fail");
.expect_err("invalid category/permission separator should fail");
PermMatcher::new("77777777777777").expect_err("overflowing octal value should fail");
// FIXME: uucore::mode shouldn't accept this
+50 -30
View File
@@ -396,7 +396,7 @@ fn format_directive<'entry>(
// NOTE ON QUOTING:
// GNU find's man page claims that several directives that print names (like
// %f) are quoted like ls; however, I could not reproduce this at all in
// pratice, thus the set of rules is undoubtedly very different (if this is
// practice, thus the set of rules is undoubtedly very different (if this is
// still done at all).
let res: Cow<'entry, str> = match directive {
@@ -463,11 +463,13 @@ fn format_directive<'entry>(
#[cfg(unix)]
FormatDirective::Filesystem => {
let dev_id = meta()?.dev().to_string();
uucore::fsext::read_fs_list()
let fs_list =
uucore::fsext::read_fs_list().expect("Could not find the filesystem info");
fs_list
.into_iter()
.find(|fs| fs.dev_id == dev_id)
.map(|fs| fs.fs_type)
.unwrap_or_else(|| "".to_owned())
.unwrap_or_else(String::new)
.into()
}
@@ -946,52 +948,70 @@ mod tests {
#[cfg(unix)]
{
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink("subdir", "test_data/links/link-d") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink("missing", "test_data/links/link-missing") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink("abbbc/x", "test_data/links/link-notdir") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink("link-loop", "test_data/links/link-loop") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
}
#[cfg(windows)]
{
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink_dir("subdir", "test_data/links/link-d") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink_file("missing", "test_data/links/link-missing") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink_file("abbbc/x", "test_data/links/link-notdir") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
}
+3 -3
View File
@@ -261,7 +261,7 @@ mod tests {
deps.set_time(files_mtime - Duration::new(1_u64, 0));
assert!(
!exactly_one_day_matcher.matches(&file, &mut deps.new_matcher_io()),
"future-modified file shouldn'1 match exactly 1 day old"
"future-modified file shouldn't match exactly 1 day old"
);
assert!(
!more_than_one_day_matcher.matches(&file, &mut deps.new_matcher_io()),
@@ -311,14 +311,14 @@ mod tests {
}
thread::sleep(Duration::from_secs(2));
// read the file agaion - potentially changing accessed time
// read the file again - potentially changing accessed time
{
let mut f = File::open(&foo_path).expect("open temp file");
let _ = f.read(&mut buffer);
}
// OK our modification time and creation time should definitely be different
// and depending on our platform and file system, our accessed time migh be
// and depending on our platform and file system, our accessed time might be
// different too.
let file_info = get_dir_entry_for(&temp_dir.path().to_string_lossy(), "foo");
+20 -12
View File
@@ -110,27 +110,35 @@ mod tests {
#[cfg(unix)]
{
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink("subdir", "test_data/links/link-d") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
};
#[cfg(windows)]
let _ = {
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink_dir("subdir", "test_data/links/link-d") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
};
+10 -6
View File
@@ -338,15 +338,19 @@ mod tests {
fn create_file_link() {
#[cfg(unix)]
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
#[cfg(windows)]
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
}
+4 -3
View File
@@ -78,13 +78,14 @@ fn main() {
usage();
}
let mut config = Config {
destination_dir: if args[1] != "-" {
Some(args[1].clone())
} else {
destination_dir: if args[1] == "-" {
None
} else {
Some(args[1].clone())
},
..Default::default()
};
for arg in &args[2..] {
if arg.starts_with("--") {
match arg.as_ref() {
+22 -14
View File
@@ -1,6 +1,6 @@
// Copyright 2021 Chad Williamson <chad@dahc.us>
//
// Use of this source code is governed by an MIT-syle license that can be
// Use of this source code is governed by an MIT-style license that can be
// found in the LICENSE file or at https://opensource.org/licenses/MIT.
// This file contains integration tests for the find command.
@@ -321,24 +321,32 @@ fn find_printf() {
#[cfg(windows)]
{
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink_dir("subdir", "test_data/links/link-d") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink_file("missing", "test_data/links/link-missing") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
if let Err(e) = symlink_file("abbbc/x", "test_data/links/link-notdir") {
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
}
}
@@ -476,7 +484,7 @@ fn find_mount_xdev() {
#[serial(working_dir)]
#[test]
fn find_accessable() {
fn find_accessible() {
Command::cargo_bin("find")
.expect("found binary")
.args(["test_data", "-readable"])