MCPcopy
hub / github.com/qax-os/excelize / TestInsertRowsInEmptyFile

Function TestInsertRowsInEmptyFile

rows_test.go:403–415  ·  view source on GitHub ↗

Test internal structure state after insert operations. It is important for insert workflow to be constant to avoid side effect with functions related to internal structure.

(t *testing.T)

Source from the content-addressed store, hash-verified

401// for insert workflow to be constant to avoid side effect with functions
402// related to internal structure.
403func TestInsertRowsInEmptyFile(t *testing.T) {
404 f := NewFile()
405 sheet1 := f.GetSheetName(0)
406 r, err := f.workSheetReader(sheet1)
407 assert.NoError(t, err)
408 assert.NoError(t, f.InsertRows(sheet1, 1, 1))
409 assert.Len(t, r.SheetData.Row, 0)
410 assert.NoError(t, f.InsertRows(sheet1, 2, 1))
411 assert.Len(t, r.SheetData.Row, 0)
412 assert.NoError(t, f.InsertRows(sheet1, 99, 1))
413 assert.Len(t, r.SheetData.Row, 0)
414 assert.NoError(t, f.SaveAs(filepath.Join("test", "TestInsertRowInEmptyFile.xlsx")))
415}
416
417func prepareTestBook2() (*File, error) {
418 f := NewFile()

Callers

nothing calls this directly

Calls 6

GetSheetNameMethod · 0.95
workSheetReaderMethod · 0.95
InsertRowsMethod · 0.95
SaveAsMethod · 0.95
NewFileFunction · 0.85
LenMethod · 0.80

Tested by

no test coverage detected