diff --git a/cell_test.go b/cell_test.go index b3bb997..8d00e2d 100644 --- a/cell_test.go +++ b/cell_test.go @@ -682,8 +682,10 @@ func TestSharedStringsError(t *testing.T) { rows, err := f.Rows("Sheet1") assert.NoError(t, err) const maxUint16 = 1<<16 - 1 + currentRow := 0 for rows.Next() { - if rows.CurrentRow() == 19 { + currentRow++ + if currentRow == 19 { _, err := rows.Columns() assert.NoError(t, err) // Test get cell value from string item with invalid offset @@ -705,8 +707,10 @@ func TestSharedStringsError(t *testing.T) { assert.NoError(t, err) rows, err = f.Rows("Sheet1") assert.NoError(t, err) + currentRow = 0 for rows.Next() { - if rows.CurrentRow() == 19 { + currentRow++ + if currentRow == 19 { _, err := rows.Columns() assert.NoError(t, err) break diff --git a/col.go b/col.go index 8e0294f..a496e88 100644 --- a/col.go +++ b/col.go @@ -40,16 +40,6 @@ type Cols struct { sheetXML []byte } -// CurrentCol returns the column number that represents the current column. -func (cols *Cols) CurrentCol() int { - return cols.curCol -} - -// TotalCols returns the total columns count in the worksheet. -func (cols *Cols) TotalCols() int { - return cols.totalCols -} - // GetCols return all the columns in a sheet by given worksheet name (case // sensitive). For example: // diff --git a/col_test.go b/col_test.go index 2dd27db..e325ed1 100644 --- a/col_test.go +++ b/col_test.go @@ -68,8 +68,6 @@ func TestColumnsIterator(t *testing.T) { for cols.Next() { colCount++ - assert.Equal(t, colCount, cols.CurrentCol()) - assert.Equal(t, expectedNumCol, cols.TotalCols()) require.True(t, colCount <= expectedNumCol, "colCount is greater than expected") } assert.Equal(t, expectedNumCol, colCount) @@ -85,8 +83,6 @@ func TestColumnsIterator(t *testing.T) { for cols.Next() { colCount++ - assert.Equal(t, colCount, cols.CurrentCol()) - assert.Equal(t, expectedNumCol, cols.TotalCols()) require.True(t, colCount <= 4, "colCount is greater than expected") } assert.Equal(t, expectedNumCol, colCount) @@ -131,6 +127,11 @@ func TestGetColsError(t *testing.T) { cols.sheetXML = []byte(`A`) _, err = cols.Rows() assert.EqualError(t, err, newCellNameToCoordinatesError("A", newInvalidCellNameError("A")).Error()) + + f.Pkg.Store("xl/worksheets/sheet1.xml", nil) + f.Sheet.Store("xl/worksheets/sheet1.xml", nil) + _, err = f.Cols("Sheet1") + assert.NoError(t, err) } func TestColsRows(t *testing.T) { diff --git a/rows.go b/rows.go index 8072079..8702f93 100644 --- a/rows.go +++ b/rows.go @@ -79,11 +79,6 @@ type Rows struct { token xml.Token } -// CurrentRow returns the row number that represents the current row. -func (rows *Rows) CurrentRow() int { - return rows.seekRow -} - // Next will return true if find the next row element. func (rows *Rows) Next() bool { rows.seekRow++ diff --git a/rows_test.go b/rows_test.go index 0ac9271..0d2ca23 100644 --- a/rows_test.go +++ b/rows_test.go @@ -74,7 +74,6 @@ func TestRowsIterator(t *testing.T) { for rows.Next() { rowCount++ - assert.Equal(t, rowCount, rows.CurrentRow()) require.True(t, rowCount <= expectedNumRow, "rowCount is greater than expected") } assert.Equal(t, expectedNumRow, rowCount)