@@ -11,14 +11,18 @@ func TestGetInternalClassAndCourseNum(t *testing.T) {
1111
1212 for name , testCase := range testDataCache {
1313 t .Run (name , func (t * testing.T ) {
14- classNum , _ := getInternalClassAndCourseNum (testCase .ClassInfo )
14+ classNum , courseNum := getInternalClassAndCourseNum (testCase .ClassInfo )
1515 expectedClassNum := testCase .Section .Internal_class_number
16+ expectedCourseNumber := testCase .Course .Internal_course_number
1617
17- diff := cmp .Diff (expectedClassNum , classNum )
18+ if classNum != expectedClassNum {
19+ t .Errorf ("Class Number: expected %s got %s" , expectedClassNum , classNum )
20+ }
1821
19- if diff != "" {
20- t .Errorf ("Failed (- expected + got) \n %s" , diff )
22+ if courseNum != expectedCourseNumber {
23+ t .Errorf ("Class Number: expected %s got %s" , expectedCourseNumber , courseNum )
2124 }
25+
2226 })
2327 }
2428}
@@ -48,10 +52,8 @@ func TestGetSectionNumber(t *testing.T) {
4852 output := getSectionNumber (testCase .ClassInfo )
4953 expected := testCase .Section .Section_number
5054
51- diff := cmp .Diff (expected , output )
52-
53- if diff != "" {
54- t .Errorf ("Failed (-expected +got)\n %s" , diff )
55+ if output != expected {
56+ t .Errorf ("expected %s got %s" , expected , output )
5557 }
5658 })
5759
@@ -66,20 +68,10 @@ func TestGetTeachingAssistants(t *testing.T) {
6668 output := getTeachingAssistants (testCase .RowInfo )
6769 expected := testCase .Section .Teaching_assistants
6870
69- if len (output ) != len (expected ) {
70- t .Errorf ("expected %d assistants got %d" , len (expected ), len (output ))
71- return
72- }
73-
74- for i , assistant := range output {
75- expectedAssistant := expected [i ]
76-
77- diff := cmp .Diff (expectedAssistant , assistant )
78-
79- if diff != "" {
80- t .Errorf ("Failed (-expected +got)\n %s" , diff )
81- }
71+ diff := cmp .Diff (expected , output )
8272
73+ if diff != "" {
74+ t .Errorf ("Failed (-expected +got)\n %s" , diff )
8375 }
8476 })
8577 }
@@ -93,10 +85,8 @@ func TestGetInstructionMode(t *testing.T) {
9385 output := getInstructionMode (testCase .ClassInfo )
9486 expected := testCase .Section .Instruction_mode
9587
96- diff := cmp .Diff (expected , output )
97-
98- if diff != "" {
99- t .Errorf ("Failed (-expected +got)\n %s" , diff )
88+ if output != expected {
89+ t .Errorf ("expected %s got %s" , expected , output )
10090 }
10191 })
10292
@@ -111,19 +101,10 @@ func TestGetMeetings(t *testing.T) {
111101 output := getMeetings (testCase .RowInfo )
112102 expected := testCase .Section .Meetings
113103
114- if len (output ) != len (expected ) {
115- t .Errorf ("expected %d meetings got %d" , len (expected ), len (output ))
116- return
117- }
118-
119- for i , meeting := range output {
120- expectedMeeting := expected [i ]
121-
122- diff := cmp .Diff (meeting , expectedMeeting )
104+ diff := cmp .Diff (expected , output )
123105
124- if diff != "" {
125- t .Errorf ("Failed (-expected +got)\n %s" , diff )
126- }
106+ if diff != "" {
107+ t .Errorf ("Failed (-expected +got)\n %s" , diff )
127108 }
128109 })
129110 }
@@ -154,10 +135,8 @@ func TestGetSyllabusUri(t *testing.T) {
154135 output := getSyllabusUri (testCase .RowInfo )
155136 expected := testCase .Section .Syllabus_uri
156137
157- diff := cmp .Diff (expected , output )
158-
159- if diff != "" {
160- t .Errorf ("Failed (-expected +got)\n %s" , diff )
138+ if output != expected {
139+ t .Errorf ("expected %s got %s" , expected , output )
161140 }
162141 })
163142
0 commit comments