https://github.com/bigbuildbench/google_assertor

https://github.com/bigbuildbench/google_assertor

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.6%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: BigBuildBench
  • License: apache-2.0
  • Language: Rust
  • Default Branch: master
  • Size: 163 KB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 3
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License

README.md

Assertor

Assertor makes test assertions and failure messages more human-readable.

crates.io license docs.rs OpenSSF
Scorecard

Assertor is heavily affected by Java Truth in terms of API design and error messages, but this is a totally different project from Java Truth.

Disclaimer

This is not an official Google product, it is just code that happens to be owned by Google.

⚠ The API is not fully stable and may be changed until version 1.0.

Example

```rust use assertor::*;

[test]

fn testit() { assertthat!("foobarbaz").contains("bar"); assertthat!("foobarbaz").endswith("baz");

assert_that!(0.5).with_abs_tol(0.2).is_approx_equal_to(0.6);

assert_that!(vec!["a", "b"]).contains("a");
assert_that!(vec!["a", "b"]).has_length(2);
assert_that!(vec!["a", "b"]).contains_exactly(vec!["a", "b"]);

assert_that!(Option::Some("Foo")).has_value("Foo");

} ```

Failure cases

```rust use assertor::*;

fn testit() { assertthat!(vec!["a", "b", "c"]).contains_exactly(vec!["b", "c", "d"]); // missing (1) : ["d"] // unexpected (1): ["a"] // --- // expected : ["b", "c", "d"] // actual : ["a", "b", "c"] } ```

anyhow

Supports asserting error value of anyhow under anyhow feature flag.

toml [dependencies] assertor = { version = "*", features = ["anyhow"] }

```rust use assertor::*; use anyhow::anyhow;

fn anyhow_func() -> anyhow::Result<()> { Err(anyhow!("failed to parse something in foobar")) }

fn testit() { assertthat!(anyhowfunc()).err().hasmessage("failed to parse something in foobar"); assertthat!(anyhowfunc()).err().asstring().contains("parse something"); assertthat!(anyhowfunc()).err().asstring().startswith("failed"); assertthat!(anyhowfunc()).err().asstring().ends_with("foobar"); } ```

Feature ideas

  • [ ] Color / Bold
  • [ ] Better diff: vec
  • [ ] Better diff: set
  • [ ] Better diff: HashMap

Owner

  • Name: BigBuildBench
  • Login: BigBuildBench
  • Kind: organization

abbr. B3, benchmarking the repo-level understanding capability of your LLMs by reconstructing project build-file.

GitHub Events

Total
  • Delete event: 6
  • Issue comment event: 7
  • Push event: 2
  • Pull request event: 21
  • Create event: 20
Last Year
  • Delete event: 6
  • Issue comment event: 7
  • Push event: 2
  • Pull request event: 21
  • Create event: 20

Dependencies

.github/workflows/ci.yml actions
  • actions-rs/clippy-check v1.0.7 composite
  • actions/checkout v4 composite
  • dtolnay/rust-toolchain 21dc36fb71dd22e3317045c0c31a3f4249868b17 composite
.github/workflows/publish.yml actions
  • actions/checkout v4 composite
.github/workflows/scorecard.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact 50769540e7f4bd5e21e526ee35c689e35e0d6874 composite
  • github/codeql-action/upload-sarif 461ef6c76dfe95d5c364de2f431ddbd31a417628 composite
  • ossf/scorecard-action 62b2cac7ed8198b15735ed49ab1e5cf35480ba46 composite
Cargo.toml cargo
  • test-case 3.1.0 development