Red - example 2

As mentioned in the preceding section, we need another test because the production code we have written to make the previous test pass only works for one specific headline. But the feature we want to implement has to work for all possible headlines. Add the following test to FirstDemoTests:

func test_MakeHeadline_ReturnsStringWithEachWordStartCapital2() { 
  let string = "Here is another Example" 
   

  let headline = viewController.makeHeadline(from: string) 
   

  XCTAssertEqual(headline, "Here Is Another Example") 
} 

Run the test. This new test obviously fails. Let's make the tests green.

Get Test-Driven iOS Development with Swift 4 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.