@@ -129,7 +129,7 @@ public void testParsingWithValgrindOutput() {
129
129
CTestResultParser cpar = null ;
130
130
try {
131
131
File ttmp = constructTestOutput (oneOfEachTest );
132
- File vtmp = constructNotMemoryFailingValgrindOutput ( oneOfEachTest );
132
+ File vtmp = constructMemoryFailingValgrindOutput ( );
133
133
134
134
cpar = new CTestResultParser (ttmp , vtmp , null );
135
135
cpar .parseTestOutput ();
@@ -140,11 +140,12 @@ public void testParsingWithValgrindOutput() {
140
140
}
141
141
List <TestCaseResult > results = cpar .getTestCaseResults ();
142
142
assertEquals ("There should be two test results" , 2 , results .size ());
143
- int i = 2 ;
144
- for (TestCaseResult r : results ) {
145
- assertEquals ("==" + i * 2 + "== " + (i - 1 ), r .getDetailedMessage ().split ("\n " )[1 ]);
146
- i ++;
147
- }
143
+ assertNotNull ("Valgrind errors should go in detailed message" ,
144
+ results .get (0 ).getDetailedMessage ());
145
+ assertTrue ("Valgrind errors should go in detailed message" ,
146
+ results .get (0 ).getDetailedMessage ().contains ("==1== 1" ));
147
+ assertNull ("Valgrind output should go into detailed message if there were not errors" ,
148
+ results .get (1 ).getDetailedMessage ());
148
149
}
149
150
150
151
@ Test
@@ -163,10 +164,9 @@ public void testTestsPassWhenNoMemoryErrors() {
163
164
}
164
165
List <TestCaseResult > results = cpar .getTestCaseResults ();
165
166
assertEquals ("There should be two test results" , 2 , results .size ());
166
- int i = 2 ;
167
167
for (TestCaseResult r : results ) {
168
- assertEquals ( "==" + i * 2 + "== " + ( i - 1 ), r . getDetailedMessage (). split ( " \n " )[ 1 ]);
169
- i ++ ;
168
+ assertNull ( "Valgrind output should be empty when there was no error" ,
169
+ r . getDetailedMessage ()) ;
170
170
}
171
171
}
172
172
0 commit comments