Skip to content

Preserve empty CSV fields and quoted-empty rows at EOF - #146

Open
rupayon123 wants to merge 1 commit into
swiftcsv:masterfrom
rupayon123:contribution/preserve-final-empty-fields-20260922
Open

rupayon123 wants to merge 1 commit into
swiftcsv:masterfrom
rupayon123:contribution/preserve-final-empty-fields-20260922

Conversation

@rupayon123

Copy link
Copy Markdown

The EOF flush currently appends the last field only if its text is nonempty. This drops a trailing empty column (value,) and an entire quoted-empty single-field row ("") unless a newline follows. Preserve an empty field when there are earlier fields or an explicitly started field, while honoring row offsets and limits and avoiding an extra row after completed/empty input.

The five-test regression/control group produces seven failed assertions before the patch. All 47 Swift package tests pass after it. Coverage includes trailing delimiters, quoted empties, header/row width, serialization, whitespace-only and newline-terminated input, skipped rows and row limits. Scoped SwiftLint reports existing Parser.swift spacing/long-signature/void-return warnings; no new warning is on the changed code or test file. git diff --check passes.

This is independent of #145's serializer quoting fix and based directly on master. Tests ran on macOS; no device or full Apple-platform matrix claim is made. Prepared with AI assistance; EOF state, skipped-row handling and the actual diff were reviewed.

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.

1 participant