nimble_operator - ApplebaumIan/BitbucketAPI GitHub Wiki

Nimble Operator

Prefer Nimble operator overloads over free matcher functions.

  • Identifier: nimble_operator
  • Enabled by default: Disabled
  • Supports autocorrection: Yes
  • Kind: idiomatic
  • Analyzer rule: No
  • Minimum Swift compiler version: 3.0.0
  • Default configuration: warning

Non Triggering Examples

expect(seagull.squawk) != "Hi!"

expect("Hi!") == "Hi!"

expect(10) > 2

expect(10) >= 10

expect(10) < 11

expect(10) <= 10

expect(x) === x
expect(10) == 10
expect(success) == true
expect(object.asyncFunction()).toEventually(equal(1))

expect(actual).to(haveCount(expected))

foo.method {
    expect(value).to(equal(expectedValue), description: "Failed")
    return Bar(value: ())
}

Triggering Examples

↓expect(seagull.squawk).toNot(equal("Hi"))

↓expect(12).toNot(equal(10))

↓expect(10).to(equal(10))

↓expect(10, line: 1).to(equal(10))

↓expect(10).to(beGreaterThan(8))

↓expect(10).to(beGreaterThanOrEqualTo(10))

↓expect(10).to(beLessThan(11))

↓expect(10).to(beLessThanOrEqualTo(10))

↓expect(x).to(beIdenticalTo(x))

↓expect(success).to(beTrue())

↓expect(success).to(beFalse())

expect(10) > 2
 ↓expect(10).to(beGreaterThan(2))