Skip to content

Commit

Permalink
[master] - rows on data tables are now public...how on earth was that…
Browse files Browse the repository at this point in the history
… not already true? - TT
  • Loading branch information
Tyler-Keith-Thompson committed Apr 22, 2021
1 parent c6ac5f4 commit edcf68c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/CucumberSwift/Gherkin/Parser/DataTable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation
public class DataTable {
public typealias Row = [String]
var rows = [Row]()
public var rows = [Row]()
init(_ lines:[Row]) {
rows = lines
}
Expand Down
11 changes: 11 additions & 0 deletions Tests/CucumberSwiftConsumerTests/CucumberSwiftConsumerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ extension Cucumber: StepImplementation {
XCTAssert(true)
}
Given("^I point my step to a unit test$", class:Me.self, selector: #selector(Me.unitTestIsExecuted))
Given("^a step with a data table$") { _, step in
guard let dataTable = step.dataTable else {
XCTFail("no data table found!")
return
}
XCTAssertEqual(dataTable.rows.count, 2)
XCTAssertEqual(dataTable.rows[0][0], "foo")
XCTAssertEqual(dataTable.rows[0][1], "bar")
XCTAssertEqual(dataTable.rows[1][0], "boz")
XCTAssertEqual(dataTable.rows[1][1], "boo")
}

When("^I run the tests$") { _, step in
XCTAssert(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ as expected
When I run the tests
Then The unit test runs

Scenario: Something with a data table
Given a step with a data table
| foo | bar |
| boz | boo |
When I run the tests
Then I can access the data table

Scenario: Unimplemented scenario with DocString
Given a DocString of some kind that is not implemented
"""xml
Expand Down

0 comments on commit edcf68c

Please sign in to comment.