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

Fix quotes bug #12

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

## v2.0.2 - 25 October 2024
- Patch to fix bug with handling closing quotes before a newline.

## v2.0.1 - 26 September 2024
- Patch to consider all headers in from_dicts.

Expand Down
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "gsv"
version = "2.0.1"
version = "2.0.2"
gleam = ">= 0.32.0"
description = "A simple csv parser and generator written in gleam "

Expand Down
3 changes: 2 additions & 1 deletion src/gsv/internal/ast.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ fn parse_p(
[curr_line, ..previously_parsed_lines]
->
parse_p(remaining_tokens, InsideEscapedString, [
["", ..curr_line],
[""],
curr_line,
..previously_parsed_lines
])

Expand Down
13 changes: 13 additions & 0 deletions test/gsv_test.gleam
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import gleam/dict
import gleam/int
import gleam/io
import gleam/list
import gleam/result
import gleam/string
Expand Down Expand Up @@ -234,3 +235,15 @@ pub fn dicts_with_missing_values_test() {
"colour,name,score,youtube\nPink,Lucy,100,\n,Isaac,99,@IsaacHarrisHolt",
)
}

pub fn quotes_test() {
let stringy =
"\"Date\",\"Type\",\"Price\",\"Ammount\"\n\"11/11/2024\",\"Apples\",\"7\",\"5\""

gsv.to_lists(stringy)
|> should.be_ok
|> should.equal([
["Date", "Type", "Price", "Ammount"],
["11/11/2024", "Apples", "7", "5"],
])
}
Loading