Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,6 @@ possibilities for custom assertions, including examples.

[`assertions`]: https://docs.rs/asserting/latest/asserting/assertions/

[`DefinedOrderProperty`]: https://docs.rs/asserting/latest/asserting/properties/trait.DefinedOrderProperty.html

[`IsEmptyProperty`]: https://docs.rs/asserting/latest/asserting/properties/trait.IsEmptyProperty.html

[`LengthProperty`]: https://docs.rs/asserting/latest/asserting/properties/trait.LengthProperty.html
Expand Down
10 changes: 3 additions & 7 deletions src/derived_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ use crate::expectations::{
string_contains, string_contains_any_of, string_ends_with, string_starts_with,
};
use crate::properties::{
AdditiveIdentityProperty, CharCountProperty, DecimalProperties, DefinedOrderProperty,
InfinityProperty, IsEmptyProperty, IsNanProperty, LengthProperty, MapProperties,
MultiplicativeIdentityProperty, SignumProperty,
AdditiveIdentityProperty, CharCountProperty, DecimalProperties, InfinityProperty,
IsEmptyProperty, IsNanProperty, LengthProperty, MapProperties, MultiplicativeIdentityProperty,
SignumProperty,
};
use crate::spec::{
AdHocRepresentation, And, AssertFailure, CollectFailures, DebugRepresentation, DiffFormat,
Expand Down Expand Up @@ -1619,9 +1619,7 @@ where
impl<'a, O, S, T, E, D> AssertIteratorContainsInOrder<E> for DerivedSpec<'a, O, S, D>
where
S: IntoIterator<Item = T>,
<S as IntoIterator>::IntoIter: DefinedOrderProperty,
E: IntoIterator,
<E as IntoIterator>::IntoIter: DefinedOrderProperty,
T: PartialEq<<E as IntoIterator>::Item>,
D: Represent<T> + Represent<<E as IntoIterator>::Item> + Clone,
O: DoFail,
Expand Down Expand Up @@ -1725,7 +1723,6 @@ where
impl<'a, O, S, T, D> AssertOrderedElements for DerivedSpec<'a, O, S, D>
where
S: IntoIterator<Item = T>,
<S as IntoIterator>::IntoIter: DefinedOrderProperty,
D: Represent<T> + Clone,
O: DoFail + GetFailures,
{
Expand Down Expand Up @@ -1888,7 +1885,6 @@ where
impl<'a, O, S, T, U, D> AssertOrderedElementsRef for DerivedSpec<'a, O, S, D>
where
S: IntoIterator<Item = T>,
<S as IntoIterator>::IntoIter: DefinedOrderProperty,
T: ToOwned<Owned = U>,
D: Represent<T> + Clone,
O: DoFail + GetFailures,
Expand Down
5 changes: 0 additions & 5 deletions src/iterator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::expectations::{
iterator_contains_only, iterator_contains_only_once, iterator_contains_sequence,
iterator_ends_with, iterator_starts_with, none_satisfies, not,
};
use crate::properties::DefinedOrderProperty;
use crate::spec::{
DiffFormat, DisplayRepresentation, Expectation, Expecting, Expression, FailingStrategy,
GetFailures, Invertible, PanicOnFail, Represent, Represented, RepresentedBy, Spec,
Expand Down Expand Up @@ -502,9 +501,7 @@ where
impl<'a, S, T, E, D, R> AssertIteratorContainsInOrder<E> for Spec<'a, S, D, R>
where
S: IntoIterator<Item = T>,
<S as IntoIterator>::IntoIter: DefinedOrderProperty,
E: IntoIterator,
<E as IntoIterator>::IntoIter: DefinedOrderProperty,
T: PartialEq<<E as IntoIterator>::Item>,
D: Represent<T> + Represent<<E as IntoIterator>::Item> + Clone,
R: FailingStrategy,
Expand Down Expand Up @@ -1161,7 +1158,6 @@ where
impl<'a, S, T, D, R> AssertOrderedElements for Spec<'a, S, D, R>
where
S: IntoIterator<Item = T>,
<S as IntoIterator>::IntoIter: DefinedOrderProperty,
D: Represent<T> + Clone,
R: FailingStrategy,
{
Expand Down Expand Up @@ -1245,7 +1241,6 @@ where
impl<'a, S, T, U, D, R> AssertOrderedElementsRef for Spec<'a, S, D, R>
where
S: IntoIterator<Item = T>,
<S as IntoIterator>::IntoIter: DefinedOrderProperty,
T: 'a + ToOwned<Owned = U>,
U: Clone,
D: Represent<T> + Clone,
Expand Down
40 changes: 40 additions & 0 deletions src/iterator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,3 +1115,43 @@ mod extracted_elements_ref {
);
}
}

mod derived_iterator {
use super::*;

#[test]
fn derived_iterator_contains_exactly_elements() {
let subject = ["one", "two", "three", "four", "five"];
let derived_iter = subject.into_iter().skip(1).take(3);

assert_that(derived_iter).contains_exactly(["two", "three", "four"]);
}

#[test]
fn derived_iterator_starts_with_element() {
let subject = ["one", "two", "three", "four", "five"];
let derived_iter = subject.into_iter().skip(1).take(3);

assert_that(derived_iter).starts_with(["two"]);
}

#[test]
fn derived_iterator_ends_with_sequence() {
let subject = ["one", "two", "three", "four", "five"];
let derived_iter = subject.into_iter().skip(1).take(3);

assert_that(derived_iter).ends_with(["three", "four"]);
}

#[test]
fn first_element_of_derived_iterator_with_several_elements() {
let subject = ["one", "two", "three", "four", "five"];
let derived_iter = subject.into_iter().skip(1).take(3);

assert_that(derived_iter)
.first_element()
.is_equal_to("two")
.has_length(3)
.starts_with('t');
}
}
Loading