cairo-lang-test-runner 2.12.4-dev.0

Cairo tests runner. Used to run tests written in Cairo.
docs.rs failed to build cairo-lang-test-runner-2.12.4-dev.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: cairo-lang-test-runner-2.17.0-rc.0

Testing cairo files

cargo run --bin cairo-test -- --single-file /path/to/file.cairo

We can use this command to run Cairo level tests.

Example

#[test]
fn test_assert_true() {
    // Asserts that true
    assert(true, 'assert(true)');
}

#[test]
#[should_panic]
fn test_assert_false() {
    assert(false, 'assert(false)');
}

Longer Example

Longer example can be found at Core Library Test.

cargo run --bin cairo-test -- corelib/

Filtering

You can run only tests containing a given string using -f <filter_string>. For example:

cargo run --bin cairo-test -- --single-file /path/to/file.cairo -f specific_test