Compare commits

...

5 Commits

Author SHA1 Message Date
dependabot[bot]
0aef063b0d
Merge fe1a9705f6 into c384eed937 2024-09-21 22:34:16 +09:00
dvermd
c384eed937 Do not double panic in FakeParentArgs::drop
Signed-off-by: dvermd <315743+dvermd@users.noreply.github.com>
2024-09-15 10:42:35 +02:00
Dan Davison
7dd279284b Update release Makefile 2024-09-11 08:51:11 -04:00
Dan Davison
9b80e68904 Link to new binaries 2024-09-11 08:49:53 -04:00
dependabot[bot]
fe1a9705f6
Bump insta from 1.39.0 to 1.40.0
Bumps [insta](https://github.com/mitsuhiko/insta) from 1.39.0 to 1.40.0.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/1.39.0...1.40.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-09 06:11:31 +00:00
4 changed files with 50 additions and 27 deletions

4
Cargo.lock generated
View File

@ -741,9 +741,9 @@ dependencies = [
[[package]]
name = "insta"
version = "1.39.0"
version = "1.40.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "810ae6042d48e2c9e9215043563a58a80b877bc863228a74cf10c49d4620a6f5"
checksum = "6593a41c7a73841868772495db7dc1e8ecab43bb5c0b6da2059246c4b506ab60"
dependencies = [
"console",
"lazy_static",

View File

@ -48,10 +48,9 @@ BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL=.make-sentinels/bump-version-in-doc
bump-version-in-documentation-links: $(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL)
$(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL):
sed -i -E "s,$$DELTA_OLD_VERSION,$$DELTA_NEW_VERSION,g" manual/src/full---help-output.md manual/src/installation.md
rg -qF "$$DELTA_NEW_VERSION" manual/src/full---help-output.md
rg -qF "$$DELTA_NEW_VERSION" manual/src/installation.md
git add manual/src/full---help-output.md manual/src/installation.md
git commit -m "Bump version in links to executables"
git commit -m "Link to new binaries"
touch $(BUMP_VERSION_IN_DOCUMENTATION_LINKS_SENTINEL)

View File

@ -1,13 +1,13 @@
# Installation
You can download an executable for your system:
[Linux (glibc)](https://github.com/dandavison/delta/releases/download/0.18.1/delta-0.18.1-x86_64-unknown-linux-gnu.tar.gz)
[Linux (glibc)](https://github.com/dandavison/delta/releases/download/0.18.2/delta-0.18.2-x86_64-unknown-linux-gnu.tar.gz)
|
[Linux (musl)](https://github.com/dandavison/delta/releases/download/0.18.1/delta-0.18.1-x86_64-unknown-linux-musl.tar.gz)
[Linux (musl)](https://github.com/dandavison/delta/releases/download/0.18.2/delta-0.18.2-x86_64-unknown-linux-musl.tar.gz)
|
[MacOS](https://github.com/dandavison/delta/releases/download/0.18.1/delta-0.18.1-x86_64-apple-darwin.tar.gz)
[MacOS](https://github.com/dandavison/delta/releases/download/0.18.2/delta-0.18.2-x86_64-apple-darwin.tar.gz)
|
[Windows](https://github.com/dandavison/delta/releases/download/0.18.1/delta-0.18.1-x86_64-pc-windows-msvc.zip)
[Windows](https://github.com/dandavison/delta/releases/download/0.18.2/delta-0.18.2-x86_64-pc-windows-msvc.zip)
|
[All](https://github.com/dandavison/delta/releases)

View File

@ -598,6 +598,7 @@ pub mod tests {
With(usize, Rc<Vec<T>>),
None,
Invalid,
ErrorAlreadyHandled,
}
// When calling `FakeParentArgs::get()`, it can return `Some(values)` which were set earlier
@ -648,24 +649,39 @@ pub mod tests {
TlsState::With(n, args) => TlsState::With(*n + 1, Rc::clone(args)),
TlsState::None => TlsState::None,
TlsState::Invalid => TlsState::Invalid,
TlsState::ErrorAlreadyHandled => TlsState::ErrorAlreadyHandled,
});
match old_value {
TlsState::Once(args) | TlsState::Scope(args) => Some(args),
TlsState::With(n, args) if n < args.len() => Some(args[n].clone()),
TlsState::None => None,
TlsState::Invalid | TlsState::With(_, _) => Self::error("get"),
TlsState::Invalid | TlsState::With(_, _) | TlsState::ErrorAlreadyHandled => {
Self::error("get");
None
}
}
})
}
pub fn are_set() -> bool {
FAKE_ARGS.with(|a| *a.borrow() != TlsState::None)
FAKE_ARGS.with(|a| {
*a.borrow() != TlsState::None && *a.borrow() != TlsState::ErrorAlreadyHandled
})
}
fn error(where_: &str) -> ! {
panic!(
"test logic error (in {}): wrong FakeParentArgs scope?",
where_
);
fn error(where_: &str) {
FAKE_ARGS.with(|a| {
let old_value = a.replace(TlsState::ErrorAlreadyHandled);
match old_value {
TlsState::ErrorAlreadyHandled => (),
_ => {
panic!(
"test logic error (in {}): wrong FakeParentArgs scope?",
where_
);
}
}
});
}
}
impl Drop for FakeParentArgs {
@ -680,7 +696,7 @@ pub mod tests {
}
}
TlsState::Once(_) | TlsState::None => Self::error("drop"),
TlsState::Scope(_) | TlsState::Invalid => {}
TlsState::Scope(_) | TlsState::Invalid | TlsState::ErrorAlreadyHandled => {}
}
});
}
@ -838,7 +854,7 @@ pub mod tests {
}
#[test]
#[should_panic]
#[should_panic(expected = "test logic error (in get): wrong FakeParentArgs scope?")]
fn test_process_testing_assert() {
let _args = FakeParentArgs::once("git blame do.not.panic");
assert_eq!(
@ -850,13 +866,23 @@ pub mod tests {
}
#[test]
#[should_panic]
fn test_process_testing_assert_never_used() {
#[should_panic(expected = "test logic error (in drop): wrong FakeParentArgs scope?")]
fn test_process_testing_assert_once_never_used() {
let _args = FakeParentArgs::once("never used");
}
// causes a panic while panicking, so can't test:
// let _args = FakeParentArgs::for_scope(&"never used");
// let _args = FakeParentArgs::once(&"never used");
#[test]
#[should_panic(expected = "test logic error (in once): wrong FakeParentArgs scope?")]
fn test_process_testing_assert_for_scope_never_used() {
let _args = FakeParentArgs::for_scope(&"never used");
let _args = FakeParentArgs::once(&"never used");
}
#[test]
#[should_panic(expected = "test logic error (in for_scope): wrong FakeParentArgs scope?")]
fn test_process_testing_assert_once_never_used2() {
let _args = FakeParentArgs::once(&"never used");
let _args = FakeParentArgs::for_scope(&"never used");
}
#[test]
@ -879,13 +905,13 @@ pub mod tests {
}
#[test]
#[should_panic]
#[should_panic(expected = "test logic error (in drop with): wrong FakeParentArgs scope?")]
fn test_process_testing_n_times_unused() {
let _args = FakeParentArgs::with(&["git blame once", "git blame twice"]);
}
#[test]
#[should_panic]
#[should_panic(expected = "test logic error (in drop with): wrong FakeParentArgs scope?")]
fn test_process_testing_n_times_underused() {
let _args = FakeParentArgs::with(&["git blame once", "git blame twice"]);
assert_eq!(
@ -895,15 +921,13 @@ pub mod tests {
}
#[test]
#[should_panic]
#[ignore]
#[should_panic(expected = "test logic error (in get): wrong FakeParentArgs scope?")]
fn test_process_testing_n_times_overused() {
let _args = FakeParentArgs::with(&["git blame once"]);
assert_eq!(
calling_process_cmdline(ProcInfo::new(), guess_git_blame_filename),
Some("once".into())
);
// ignored: dropping causes a panic while panicking, so can't test
calling_process_cmdline(ProcInfo::new(), guess_git_blame_filename);
}