Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CharSequenceToContainCheckerSamples.kt infix style #1558

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package ch.tutteli.atrium.api.infix.en_GB.samples

import ch.tutteli.atrium.api.infix.en_GB.*
import ch.tutteli.atrium.api.verbs.expect
import kotlin.test.Test

class CharSequenceToContainCheckerSamples {

@Test
fun atLeast() {
expect("ABBC") toContain o atLeast 2 value "B"

fails {
expect("ABB") toContain o atLeast 2 value "A"
}
}

@Test
fun atMost() {
expect("ABBC") toContain o atMost 2 value "B"

fails {
expect("AABBAA") toContain o atMost 3 value "A"
}
}

@Test
fun notOrAtMost() {
expect("ABBC") toContain o notOrAtMost 2 value "D"
expect("ABBC") toContain o notOrAtMost 2 value "B"

fails {
expect("AABBAA") toContain o notOrAtMost 3 value "A"
}
}

@Test
fun butAtMost() {
expect("ABBC") toContain o atLeast 1 butAtMost 2 value "B"

fails {
expect("ABBBBCD") toContain o atLeast 2 butAtMost 3 value "B"
}
}

@Test
fun exactly() {
expect("ABCBAC") toContain o exactly 2 value "C"

fails {
expect("ABBBBCD") toContain o exactly 3 value "B"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package ch.tutteli.atrium.api.infix.en_GB.samples

import ch.tutteli.atrium.api.infix.en_GB.*
import ch.tutteli.atrium.api.verbs.expect
import kotlin.test.Test

class CharSequenceToContainCreatorSamples {

@Test
fun value() {
expect("ABC") toContain exactly(1).value("A")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only half infix 🙂 (I guess this does not compile or does it?)
More things to fix also further below

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

expect("ABBBC") toContain atLeast(2).value("B")

fails {
expect("AAAAAA") toContain atMost(3).value("A")
}
}

@Test
fun valueIgnoringCase() {
expect("ABC") toContain ignoringCase value("a")
expect("AbbbC") toContain ignoringCase value("B")

fails {
expect("AAAAAA") toContain ignoringCase value("B")
}
}

@Test
fun valueIgnoringCaseWithChecker() {
expect("ABC") toContain ignoringCase exactly(1).value("A")
expect("AAABBC") toContain ignoringCase atMost(3).value("b")
expect("aBBBCD") toContain ignoringCase atLeast(1).value("A")

fails {
expect("AAAAAABBBB") toContain ignoringCase atMost(3).value("A")
}
fails {
expect("AAABBBb") toContain ignoringCase exactly(3).value("b")
}
fails {
expect("AAAAAABBBB") toContain ignoringCase atLeast(3).value("D")
}
}

@Test
fun values() {
expect("ABC") toContain exactly(1).values("A", "B", "C")
expect("AAABC") toContain atMost(3).values("A", "B", "C")
expect("ABBBCD") toContain atLeast(1).values("A", "B", "C", "D")

fails {
expect("AAAAAABBBB") toContain atMost(3).values("A", "B")
}
fails {
expect("AAABBBB") toContain exactly(3).values("A", "B")
}
fails {
expect("AAAAAABBBB") toContain atLeast(3).values("A", "B", "C")
}
}

@Test
fun valuesIgnoringCase() {
expect("AbC") toContain ignoringCase values("A", "B", "c")

fails {
expect("aabaabbb") toContain ignoringCase values("A", "B", "C")
}
}

@Test
fun valuesIgnoringCaseWithChecker() {
expect("ABc") toContain ignoringCase exactly(1).values("A", "b", "C")
expect("AaaBC") toContain ignoringCase atMost(3).values("A", "B", "c")
expect("ABBBcD") toContain ignoringCase atLeast(1).values("a", "b", "C", "d")

fails {
expect("AAAAAABBBB") toContain ignoringCase atMost(3).values("a", "b")
}
fails {
expect("AAABBBB") toContain ignoringCase exactly(3).values("A", "b")
}
fails {
expect("AAAAAABBBB") toContain ignoringCase atLeast(3).values("a", "b", "C")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ch.tutteli.atrium.api.infix.en_GB.samples

import ch.tutteli.atrium.api.infix.en_GB.*
import ch.tutteli.atrium.api.verbs.expect
import kotlin.test.Test

class CharSequenceToContainSearchBehaviourSamples {

@Test
fun ignoringCase() {
expect("ABC") containsIgnoringCase exactly 1 value "a"
expect("ABbC") containsIgnoringCase atLeast 2 value "b"

fails {
expect("AAAaaa") containsIgnoringCase atMost 3 value "a"
}
}
}