MCPcopy Create free account

hub / github.com/cfrancia/spectral / functions

Functions231 in github.com/cfrancia/spectral

↓ 200 callersFunctionassert_that
Wraps a subject in a `Spec` to provide assertions against it. The subject must be a reference.
src/lib.rs:256
↓ 42 callersMethodfail
Builds the failure message with a description (if present), the expected value, and the actual value and then calls `panic` with the created message.
src/lib.rs:334
↓ 42 callersMethodwith_actual
Builder method to add the actual value for the panic message.
src/lib.rs:325
↓ 42 callersMethodwith_expected
Builder method to add the expected value for the panic message.
src/lib.rs:317
↓ 16 callersMethodis_equal_to
Asserts that the actual value and the expected value are equal. The value type must implement `PartialEq`. ```rust,ignore assert_that(&"hello").is_eq
src/lib.rs:423
↓ 14 callersMethodcontains
Asserts that the subject contains the provided value. The subject must implement `IntoIterator`, and the contained type must implement `PartialEq` and
src/iter.rs:45
↓ 12 callersMethodhas_file_name
Asserts that the subject `Path` has the expected file name. ```rust,ignore assert_that(&Path::new("/tmp/file")).has_file_name(&"file"); ```
src/path.rs:57
↓ 11 callersMethodcontains
Asserts that the subject `&str` contains the provided `&str`. ```rust,ignore assert_that(&"Hello").contains(&"e"); ```
src/string.rs:38
↓ 11 callersMethodends_with
Asserts that the subject `&str` ends with the provided `&str`. ```rust,ignore assert_that(&"Hello").ends_with(&"o"); ```
src/string.rs:28
↓ 11 callersMethodstarts_with
Asserts that the subject `&str` starts with the provided `&str`. ```rust,ignore assert_that(&"Hello").starts_with(&"H"); ```
src/string.rs:18
↓ 10 callersMethodis_close_to
Asserts that the subject is close to the expected value by the specified tolerance. The subject type must implement `Float` and `Debug`. ```rust,igno
src/numeric.rs:108
↓ 8 callersFunctionbuild_detail_message
(variant: &'static str, value: T)
src/result.rs:85
↓ 7 callersMethodcontains_entry
Asserts that the subject hashmap contains the expected key with the expected value. The subject type must be of `HashMap`. ```rust,ignore let mut tes
src/hashmap.rs:125
↓ 7 callersMethodis_err_containing
Asserts that the subject is an `Err` Result containing the expected value. The subject type must be a `Result`. ```rust,ignore assert_that(&Result::E
src/result.rs:61
↓ 7 callersMethodis_ok_containing
Asserts that the subject is an `Ok` Result containing the expected value. The subject type must be a `Result`. ```rust,ignore assert_that(&Result::Ok
src/result.rs:32
↓ 6 callersMethodcontains_key
Asserts that the subject hashmap contains the expected key. The subject type must be of `HashMap`. This will return a new `Spec` containing the assoc
src/hashmap.rs:72
↓ 6 callersMethodcontains_value
Asserts that the subject is a `Some` containing the expected value. The subject type must be an `Option`. ```rust,ignore assert_that(&Some(1)).contai
src/option.rs:29
↓ 6 callersMethodexists
Asserts that the subject `Path` refers to an existing location. ```rust,ignore assert_that(&Path::new("/tmp/file")).exists(); ```
src/path.rs:21
↓ 6 callersMethodis_greater_than_or_equal_to
Asserts that the subject is greater than or equal to the expected value. The subject type must implement `PartialOrd`. ```rust,ignore assert_that(&2)
src/numeric.rs:82
↓ 6 callersMethodis_less_than_or_equal_to
Asserts that the subject is less than or equal to the expected value. The subject type must implement `PartialOrd`. ```rust,ignore assert_that(&2).is
src/numeric.rs:46
↓ 6 callersMethodis_some
Asserts that the subject is `Some`. The subject type must be an `Option`. This will return a new `Spec` containing the unwrapped value if it is `Some
src/option.rs:62
↓ 6 callersMethodmatches
Accepts a function accepting the value type which returns a bool. Returning false will cause the assertion to fail. NOTE: The resultant panic message
src/lib.rs:466
↓ 5 callersMethodcontains_all_of
Asserts that the subject contains all of the provided values. The subject must implement `IntoIterator`, and the contained type must implement `Partia
src/iter.rs:57
↓ 5 callersMethoddoes_not_contain_key
Asserts that the subject hashmap does not contain the provided key. The subject type must be of `HashMap`. ```rust,ignore let mut test_map = HashMap:
src/hashmap.rs:104
↓ 5 callersMethodis_empty
Asserts that the subject `&str` is empty. ```rust,ignore assert_that(&"").is_empty(); ```
src/string.rs:48
↓ 5 callersMethodis_greater_than
Asserts that the subject is greater than the expected value. The subject type must implement `PartialOrd`. ```rust,ignore assert_that(&2).is_greater_
src/numeric.rs:64
↓ 5 callersMethodis_less_than
Asserts that the subject is less than the expected value. The subject type must implement `PartialOrd`. ```rust,ignore assert_that(&1).is_less_than(&
src/numeric.rs:28
↓ 5 callersMethodis_not_equal_to
Asserts that the actual value and the expected value are not equal. The value type must implement `PartialEq`. ```rust,ignore assert_that(&"hello").i
src/lib.rs:441
↓ 4 callersFunctioncheck_iterator_contains
(spec: &mut Spec<T>, actual_iter: I,
src/iter.rs:220
↓ 4 callersMethoddoes_not_contain
Asserts that the subject does not contain the provided value. The subject must implement `IntoIterator`, and the contained type must implement `Partia
src/iter.rs:72
↓ 4 callersMethoddoes_not_exist
Asserts that the subject `Path` does not refer to an existing location. ```rust,ignore assert_that(&Path::new("/tmp/file")).does_not_exist(); ```
src/path.rs:30
↓ 4 callersMethodequals_iterator
Asserts that the subject is equal to provided iterator. The subject must implement `IntoIterator`, the contained type must implement `PartialEq` and `
src/iter.rs:86
↓ 4 callersMethodis_a_directory
Asserts that the subject `Path` refers to an existing directory. ```rust,ignore assert_that(&Path::new("/tmp/dir/")).is_a_directory(); ```
src/path.rs:48
↓ 4 callersMethodis_a_file
Asserts that the subject `Path` refers to an existing file. ```rust,ignore assert_that(&Path::new("/tmp/file")).is_a_file(); ```
src/path.rs:39
↓ 4 callersMethodmapped_contains
Maps the values of the subject before asserting that the mapped subject contains the provided value. The subject must implement IntoIterator, and the
src/iter.rs:173
↓ 4 callersMethodthat
Creates a new assertion, passing through its description.
src/lib.rs:282
↓ 3 callersMethoddoes_not_contain_entry
Asserts that the subject hashmap does not contains the provided key and value. The subject type must be of `HashMap`. ```rust,ignore let mut test_map
src/hashmap.rs:167
↓ 3 callersFunctionfail_from_file_name
(spec: &'s S, expected: &str, actual: String)
src/path.rs:174
↓ 3 callersMethodis_empty
Asserts that the subject vector is empty. The subject type must be of `Vec`. ```rust,ignore let test_vec: Vec<u8> = vec![]; assert_that(&test_vec).is
src/vec.rs:31
↓ 3 callersMethodis_err
Asserts that the subject is `Err`. The value type must be a `Result`. This will return a new `Spec` containing the unwrapped value if it is `Err`. `
src/result.rs:128
↓ 3 callersMethodis_ok
Asserts that the subject is `Ok`. The value type must be a `Result`. This will return a new `Spec` containing the unwrapped value if it is `Ok`. ```
src/result.rs:100
↓ 2 callersFunctionasserting
Describes an assertion.
src/lib.rs:266
↓ 2 callersFunctioncheck_iterator_contains_all_of
(spec: &mut Spec<T>, actual_iter: I,
src/iter.rs:245
↓ 2 callersFunctioncompare_iterators
(spec: &mut Spec<T>, actual_iter: I, expected_iter: E)
src/iter.rs:289
↓ 2 callersFunctioncontains
(spec: &'s S, subject: &str,
src/string.rs:122
↓ 2 callersFunctiondoes_not_exist
(subject: &Path, spec: &'s S)
src/path.rs:118
↓ 2 callersFunctionends_with
(spec: &'s S, subject: &str,
src/string.rs:109
↓ 2 callersFunctionexists
(subject: &Path, spec: &'s S)
src/path.rs:109
↓ 2 callersMethodfail_with_message
Calls `panic` with the provided message, prepending the assertion description if present.
src/lib.rs:355
↓ 2 callersFunctionhas_file_name
(subject: &Path, expected_file_name: &str,
src/path.rs:146
↓ 2 callersMethodhas_length
Asserts that the length of the subject vector is equal to the provided length. The subject type must be of `Vec`. ```rust,ignore assert_that(&vec![1,
src/vec.rs:15
↓ 2 callersMethodhas_length
Asserts that the length of the subject hashmap is equal to the provided length. The subject type must be of `HashMap`. ```rust,ignore let mut test_ma
src/hashmap.rs:33
↓ 2 callersFunctionis_a_directory
(subject: &Path, spec: &'s S)
src/path.rs:136
↓ 2 callersFunctionis_a_file
(subject: &Path, spec: &'s S)
src/path.rs:127
↓ 2 callersFunctionis_empty
(spec: &'s S, subject: &str)
src/string.rs:135
↓ 2 callersMethodis_empty
Asserts that the subject hashmap is empty. The subject type must be of `HashMap`. ```rust,ignore let test_map: HashMap<u8, u8> = HashMap::new(); asse
src/hashmap.rs:50
↓ 2 callersMethodis_false
Asserts that the subject is false. The subject type must be `bool`. ```rust,ignore assert_that(&true).is_false(); ```
src/boolean.rs:28
↓ 2 callersMethodis_none
Asserts that the subject is `None`. The value type must be an `Option`. ```rust,ignore assert_that(&Option::None::<String>).is_none(); ```
src/option.rs:88
↓ 2 callersMethodis_true
Asserts that the subject is true. The subject type must be `bool`. ```rust,ignore assert_that(&true).is_true(); ```
src/boolean.rs:14
↓ 2 callersMethodmap
Transforms the subject of the `Spec` by passing it through to the provided mapping function. ```rust,ignore let test_struct = TestStruct { value: 5 }
src/lib.rs:484
↓ 2 callersMethodmatching_contains
Asserts that the subject contains a matching item by using the provided function. The subject must implement `IntoIterator`, and the contained type mu
src/iter.rs:203
↓ 2 callersMethodmaybe_build_description
(&self)
src/lib.rs:376
↓ 2 callersMethodmaybe_build_location
(&self)
src/lib.rs:369
↓ 2 callersMethodmaybe_build_subject_name
(&self)
src/lib.rs:383
↓ 2 callersMethodnamed
Associates a name with the subject. This will be displayed if the assertion fails.
src/lib.rs:406
↓ 2 callersFunctionpanic_unmatched
(spec: &mut Spec<T>, expected: E,
src/iter.rs:346
↓ 2 callersFunctionstarts_with
(spec: &'s S, subject: &str,
src/string.rs:96
↓ 1 callersFunctionbuild_file_name_message
(file_name: &str)
src/path.rs:181
↓ 1 callersMethoddescription
(&self)
src/lib.rs:301
↓ 1 callersMethodlocation
(&self)
src/lib.rs:297
↓ 1 callersMethodsubject_name
(&self)
src/lib.rs:293
Methodat_location
(self, location: String)
src/lib.rs:274
Functioncontains_entry_should_allow_multiple_borrow_forms
()
src/hashmap.rs:298
Functioncontains_key_should_allow_multiple_borrow_forms
()
src/hashmap.rs:232
Functioncontains_should_allow_for_multiple_borrow_types_for_intoiter
()
src/iter.rs:367
Functioncontains_should_allow_for_multiple_borrow_types_for_iterators
()
src/iter.rs:484
Functioncontains_value_should_allow_multiple_borrow_types
()
src/option.rs:126
Functiondoes_not_contain_key_should_allow_multiple_borrow_forms
()
src/hashmap.rs:270
Methodfrom_spec
Construct a new AssertionFailure from a DescriptiveSpec.
src/lib.rs:308
Methodget_delta_x
(&self)
src/lib.rs:523
Functionhas_file_name_should_allow_multiple_borrow_forms_for_path
()
src/path.rs:247
Functionhas_file_name_should_allow_multiple_borrow_forms_for_pathbuf
()
src/path.rs:329
Functionis_close_to_should_allow_multiple_borrow_forms
()
src/numeric.rs:208
Functionis_equal_to_should_support_multiple_borrow_forms
()
src/lib.rs:592
Functionis_error_containing_should_allow_multiple_borrow_forms
()
src/result.rs:232
Functionis_greater_than_or_equal_to_should_allow_multiple_borrow_forms
()
src/numeric.rs:189
Functionis_greater_than_should_allow_multiple_borrow_forms
()
src/numeric.rs:171
Functionis_less_than_or_equal_to_should_allow_multiple_borrow_forms
()
src/numeric.rs:152
Functionis_less_than_should_allow_multiple_borrow_forms
()
src/numeric.rs:134
Functionis_not_equal_to_should_support_multiple_borrow_forms
()
src/lib.rs:610
Functionis_ok_containing_should_allow_multiple_borrow_forms
()
src/result.rs:194
Functionshould_allow_multiple_borrow_forms_for_str
()
src/string.rs:150
Functionshould_allow_multiple_borrow_forms_for_string
()
src/string.rs:219
Functionshould_be_able_to_chain_value_from_contains_key
()
src/hashmap.rs:262
Functionshould_be_able_to_map_to_inner_field_of_struct_when_matching
()
src/lib.rs:641
Functionshould_be_able_to_unwrap_option_if_some
()
src/option.rs:120
Functionshould_be_able_to_use_function_call_with_macro
()
src/lib.rs:516
Functionshould_be_able_to_use_macro_form_with_deliberate_reference
()
src/lib.rs:502
Functionshould_be_able_to_use_macro_form_without_deliberate_reference
()
src/lib.rs:509
Functionshould_contain_assertion_description_if_message_is_provided
()
src/lib.rs:541
next →1–100 of 231, ranked by callers