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

Function TestGetTables

table_test.go:90–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func TestGetTables(t *testing.T) {
91 f := NewFile()
92 // Test get tables in none table worksheet
93 tables, err := f.GetTables("Sheet1")
94 assert.Len(t, tables, 0)
95 assert.NoError(t, err)
96 // Test get tables in not exist worksheet
97 _, err = f.GetTables("SheetN")
98 assert.EqualError(t, err, "sheet SheetN does not exist")
99 // Test adjust table with unsupported charset
100 assert.NoError(t, f.AddTable("Sheet1", &Table{Range: "B26:A21"}))
101 f.Pkg.Store("xl/tables/table1.xml", MacintoshCyrillicCharset)
102 _, err = f.GetTables("Sheet1")
103 assert.EqualError(t, err, "XML syntax error on line 1: invalid UTF-8")
104 // Test adjust table with no exist table parts
105 f.Pkg.Delete("xl/tables/table1.xml")
106 tables, err = f.GetTables("Sheet1")
107 assert.Len(t, tables, 0)
108 assert.NoError(t, err)
109}
110
111func TestDeleteTable(t *testing.T) {
112 f := NewFile()

Callers

nothing calls this directly

Calls 4

GetTablesMethod · 0.95
AddTableMethod · 0.95
NewFileFunction · 0.85
LenMethod · 0.80

Tested by

no test coverage detected