Skip to content

Commit

Permalink
Merge pull request #12 from bcpeinhardt/fix-quotes-bug
Browse files Browse the repository at this point in the history
Fix quotes bug
  • Loading branch information
bcpeinhardt authored Oct 25, 2024
2 parents 2fab9de + 4f8bdf4 commit eabab18
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
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"],
])
}

0 comments on commit eabab18

Please sign in to comment.