Fixing from review

This commit is contained in:
Mike Farah 2022-08-01 10:16:59 +10:00
parent 9628aaf8c5
commit d8f8661567
7 changed files with 11 additions and 12 deletions

View File

@ -105,21 +105,21 @@ var csvScenarios = []formatScenario{
},
{
description: "Encode array of objects to csv - missing fields behaviour",
subdescription: "First entry is used to determine the headers, and it it missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank",
subdescription: "First entry is used to determine the headers, and it is missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank",
input: expectedYamlFromCSVMissingData,
expected: csvSimpleMissingData,
scenarioType: "encode-csv",
},
{
description: "Parse CSV into an array of objects",
subdescription: "First row is assumed to define the fields",
subdescription: "First row is assumed to be the header row.",
input: csvSimple,
expected: expectedYamlFromCSV,
scenarioType: "decode-csv-object",
},
{
description: "Parse TSV into an array of objects",
subdescription: "First row is assumed to define the fields",
subdescription: "First row is assumed to be the header row.",
input: tsvSimple,
expected: expectedYamlFromCSV,
scenarioType: "decode-tsv-object",

View File

@ -1,5 +1,5 @@
# CSV
Encode/Decode to CSV or TSV.
Encode/Decode/Roundtrip CSV and TSV files.
## Encode
Currently supports arrays of homogenous flat objects, that is: no nesting and it assumes the _first_ object has all the keys required:
@ -118,7 +118,7 @@ Samantha's Rabbit,2
```
## Encode array of objects to csv - missing fields behaviour
First entry is used to determine the headers, and it it missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank
First entry is used to determine the headers, and it is missing 'likesApples', so it is not included in the csv. Second entry does not have 'numberOfCats' so that is blank
Given a sample.yml file of:
```yaml
@ -142,7 +142,7 @@ Samantha's Rabbit,,-188.8
```
## Parse CSV into an array of objects
First row is assumed to define the fields
First row is assumed to be the header row.
Given a sample.csv file of:
```csv
@ -168,7 +168,7 @@ will output
```
## Parse TSV into an array of objects
First row is assumed to define the fields
First row is assumed to be the header row.
Given a sample.tsv file of:
```tsv

View File

@ -1,5 +1,5 @@
# CSV
Encode/Decode to CSV or TSV.
Encode/Decode/Roundtrip CSV and TSV files.
## Encode
Currently supports arrays of homogenous flat objects, that is: no nesting and it assumes the _first_ object has all the keys required:

View File

@ -1,5 +1,5 @@
# Properties
Encode/Decode to/from a property file. Line comments on value nodes will be copied across.
Encode/Decode/Roundtrip to/from a property file. Line comments on value nodes will be copied across.
By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these.

View File

@ -1,6 +1,6 @@
# Properties
Encode/Decode to/from a property file. Line comments on value nodes will be copied across.
Encode/Decode/Roundtrip to/from a property file. Line comments on value nodes will be copied across.
By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these.

View File

@ -523,7 +523,6 @@ var participleLexerScenarios = []participleLexerScenario{
}
func TestParticipleLexer(t *testing.T) {
log.Errorf("TestParticiple")
lexer := newParticipleLexer()
for _, scenario := range participleLexerScenarios {

View File

@ -31,7 +31,7 @@ type expressionScenario struct {
}
func TestMain(m *testing.M) {
logging.SetLevel(logging.DEBUG, "")
logging.SetLevel(logging.ERROR, "")
Now = func() time.Time {
return time.Date(2021, time.May, 19, 1, 2, 3, 4, time.UTC)
}