Skip to content
Open
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
22 changes: 11 additions & 11 deletions ods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func assert(t *testing.T, condition bool, message string) {
}
}

func integrationTest(testName, format string, inputCells [][]Cell, expectedCsv map[string][][]string) error {
func integrationTest(t *testing.T, testName, format string, inputCells [][]Cell, expectedCsv map[string][][]string) error {
lang := os.Getenv("LANG")
spreadsheet := MakeSpreadsheet(inputCells)

Expand All @@ -49,9 +49,9 @@ func integrationTest(testName, format string, inputCells [][]Cell, expectedCsv m

cmd := fmt.Sprintf("libreoffice --headless --convert-to csv:\"Text - txt - csv (StarCalc)\":\"44,34,76,1,,1031,true,true\" %s/%s-%s.%s --outdir %s", tempDir, testName, lang, format, tempDir)
loCmd := exec.Command("bash", "-c", cmd)
_, err = loCmd.Output()
out, err := loCmd.Output()
if err != nil {
panic(err)
t.Fatalf("Command failed with error: %s", string(out))
}

actualCsvBytes, _ := os.ReadFile(fmt.Sprintf("%s/%s-%s.csv", tempDir, testName, lang))
Expand Down Expand Up @@ -149,10 +149,10 @@ func TestCommonDataTypes(t *testing.T) {
},
}

err := integrationTest("common-data-types", "ods", givenThoseCells, expectedThisCsv)
err := integrationTest(t, "common-data-types", "ods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))

err = integrationTest("common-data-types", "fods", givenThoseCells, expectedThisCsv)
err = integrationTest(t, "common-data-types", "fods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))
}

Expand Down Expand Up @@ -190,10 +190,10 @@ func TestCurrencyFormatting(t *testing.T) {
},
}

err := integrationTest("currency-formatting", "ods", givenThoseCells, expectedThisCsv)
err := integrationTest(t, "currency-formatting", "ods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))

err = integrationTest("currency-formatting", "fods", givenThoseCells, expectedThisCsv)
err = integrationTest(t, "currency-formatting", "fods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))
}

Expand Down Expand Up @@ -231,10 +231,10 @@ func TestFormula(t *testing.T) {
},
}

err := integrationTest("formula", "ods", givenThoseCells, expectedThisCsv)
err := integrationTest(t, "formula", "ods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))

err = integrationTest("formula", "fods", givenThoseCells, expectedThisCsv)
err = integrationTest(t, "formula", "fods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))
}

Expand Down Expand Up @@ -272,10 +272,10 @@ func TestRanges(t *testing.T) {
},
}

err := integrationTest("ranges", "ods", givenThoseCells, expectedThisCsv)
err := integrationTest(t, "ranges", "ods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))

err = integrationTest("ranges", "fods", givenThoseCells, expectedThisCsv)
err = integrationTest(t, "ranges", "fods", givenThoseCells, expectedThisCsv)
assert(t, err == nil, fmt.Sprintf("err: %v\n", err))
}

Expand Down
Loading