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

#95 ignore white spaces before and after quotes/fields/values #96

Merged
merged 2 commits into from
Aug 20, 2021

Conversation

ondrej-kvasnovsky
Copy link
Contributor

@ondrej-kvasnovsky ondrej-kvasnovsky commented Aug 7, 2021

Fixes #95

Copy link
Contributor

@DivineDominion DivineDominion left a comment

Choose a reason for hiding this comment

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

Looks good so far, thanks for adding the test case and providing a fix!

Would be great if you could add unit tests for other whitespace characters that should be skipped, too. Tabs come to mind; more exotic spaces like the non-breaking space (⌥+space on some keyboard layouts) would be optional "stretch goals" :)

@@ -122,4 +122,14 @@ class CSVTests: XCTestCase {
XCTAssert(error is CSVParseError)
}
}

func testInit_ParseFileWithQuotesAndSpaces() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the implementation checks for isWhitespace, could you add similar-looking test cases for other whitespace characters, too?

enhanced the test data
@ondrej-kvasnovsky
Copy link
Contributor Author

Looks good so far, thanks for adding the test case and providing a fix!

Would be great if you could add unit tests for other whitespace characters that should be skipped, too. Tabs come to mind; more exotic spaces like the non-breaking space (⌥+space on some keyboard layouts) would be optional "stretch goals" :)

Ok ok. Added more test data (using https://developer.apple.com/documentation/swift/character/3127019-iswhitespace). That that is pretty much the intent of this PR.

Copy link
Contributor

@DivineDominion DivineDominion left a comment

Choose a reason for hiding this comment

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

Thanks!

@DivineDominion DivineDominion merged commit 3869051 into swiftcsv:master Aug 20, 2021
@DivineDominion
Copy link
Contributor

We've invited you to join the SwiftCSV GitHub organization – no pressure to accept! If you'd like more information on what that means, check out our contributor guidelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional spaces cause CSV parsing to fail
2 participants