parser-tests icon indicating copy to clipboard operation
parser-tests copied to clipboard

Add tests for invalid hostmasks

Open kylef opened this issue 8 years ago • 0 comments
trafficstars

I've seen in the wild servers send host mask components in the incorrect order. We should include a test to ensure that the support in wrong order is correct.

class NickTests: XCTestCase {
  // ...
 
  func testNickInitializationFromHostmaskWithWrongOrder() {
    let nick = Nick(hostmask: "kyle@hostname!ident")
 
    XCTAssertEqual(nick.nickname, "kyle")
    XCTAssertEqual(nick.ident, "ident")
    XCTAssertEqual(nick.hostname, "hostname!ident")
  }
}

kylef avatar Oct 30 '17 19:10 kylef