@@ -69,12 +69,30 @@ func TestRowsIterator(t *testing.T) {
6969
7070 rows , err := f .Rows (sheetName )
7171 require .NoError (t , err )
72+ expectedCells := [][]Cell {
73+ {Cell {Value : "Monitor" , StyleID : 1 }, Cell {StyleID : 1 }, Cell {Value : "Brand" , StyleID : 2 }, Cell {StyleID : 2 }, Cell {Value : "inlineStr" }},
74+ {Cell {Value : "> 23 Inch" , StyleID : 1 }, Cell {Value : int64 (19 ), StyleID : 1 }, Cell {Value : "HP" , StyleID : 3 }, Cell {Value : int64 (200 ), StyleID : 4 }},
75+ {Cell {Value : "20-23 Inch" , StyleID : 1 }, Cell {Value : int64 (24 ), StyleID : 1 }, Cell {Value : "DELL" , StyleID : 3 }, Cell {Value : int64 (450 ), StyleID : 4 }},
76+ {Cell {Value : "17-20 Inch" , StyleID : 1 }, Cell {Value : int64 (56 ), StyleID : 1 }, Cell {Value : "Lenove" , StyleID : 3 }, Cell {Value : int64 (200 ), StyleID : 4 }},
77+ {Cell {Value : "< 17 Inch" , StyleID : 5 }, Cell {Value : int64 (21 ), StyleID : 1 }, Cell {Value : "SONY" , StyleID : 3 }, Cell {Value : int64 (510 ), StyleID : 4 }},
78+ {Cell {}, Cell {}, Cell {Value : "Acer" , StyleID : 3 }, Cell {Value : int64 (315 ), StyleID : 4 }},
79+ {Cell {}, Cell {}, Cell {Value : "IBM" , StyleID : 3 }, Cell {Value : int64 (127 ), StyleID : 4 }},
80+ {Cell {}, Cell {}, Cell {Value : "ASUS" , StyleID : 4 }, Cell {Value : int64 (89 ), StyleID : 4 }},
81+ {Cell {}, Cell {}, Cell {Value : "Apple" , StyleID : 4 }, Cell {Value : int64 (348 ), StyleID : 4 }},
82+ {Cell {}, Cell {}, Cell {Value : "SAMSUNG" , StyleID : 4 }, Cell {Value : int64 (53 ), StyleID : 4 }},
83+ {Cell {}, Cell {}, Cell {Value : "Other" , StyleID : 4 }, Cell {Value : int64 (37 ), StyleID : 4 }, Cell {Formula : "B2+B3" , StyleID : 4 }, Cell {Formula : "IF(B2>0, (D2/B2)*100, 0)" , StyleID : 4 }, Cell {Formula : "IF(B2>0, (D2/B2)*100, 0)" , StyleID : 4 }, Cell {Formula : "IF(D2>0, (F2/D2)*100, 0)" , StyleID : 4 }, Cell {Formula : "IF(D2>0, (F2/D2)*100, 0)" , StyleID : 4 }},
84+ }
85+ gotCells := [][]Cell {}
7286
7387 for rows .Next () {
7488 rowCount ++
7589 require .True (t , rowCount <= expectedNumRow , "rowCount is greater than expected" )
90+ cols , err := rows .Columns ()
91+ require .NoError (t , err )
92+ gotCells = append (gotCells , cols )
7693 }
7794 assert .Equal (t , expectedNumRow , rowCount )
95+ assert .Equal (t , expectedCells , gotCells )
7896 assert .NoError (t , rows .Close ())
7997 assert .NoError (t , f .Close ())
8098
0 commit comments