From 530126b062a26c94b194a57a7a28ecd3df4db913 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Fri, 25 Oct 2024 15:36:43 -0500 Subject: [PATCH 1/2] fix bug --- src/gsv/internal/ast.gleam | 3 ++- test/gsv_test.gleam | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gsv/internal/ast.gleam b/src/gsv/internal/ast.gleam index fe1c66f..56f667f 100644 --- a/src/gsv/internal/ast.gleam +++ b/src/gsv/internal/ast.gleam @@ -154,7 +154,8 @@ fn parse_p( [curr_line, ..previously_parsed_lines] -> parse_p(remaining_tokens, InsideEscapedString, [ - ["", ..curr_line], + [""], + curr_line, ..previously_parsed_lines ]) diff --git a/test/gsv_test.gleam b/test/gsv_test.gleam index 3529a88..fdb681f 100644 --- a/test/gsv_test.gleam +++ b/test/gsv_test.gleam @@ -1,5 +1,6 @@ import gleam/dict import gleam/int +import gleam/io import gleam/list import gleam/result import gleam/string @@ -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"], + ]) +} From 4f8bdf44db48956c3ae853396d2d71e5c286c7fa Mon Sep 17 00:00:00 2001 From: Benjamin Date: Fri, 25 Oct 2024 15:37:45 -0500 Subject: [PATCH 2/2] readme and toml --- CHANGELOG.md | 3 +++ gleam.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65f5b6a..425a93f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/gleam.toml b/gleam.toml index 7f3d010..7e921a0 100644 --- a/gleam.toml +++ b/gleam.toml @@ -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 "