- for(const auto &s: test_case->expected_output)
- if(find(stages, s.first)==stages.end())
- fail(format("Compiler didn't produce stage %s", GL::SL::Stage::get_stage_name(s.first)));
+ while(i!=output.end() && isspace(*i))
+ ++i;
+ while(j!=expected.end() && isspace(*j))
+ ++j;
+
+ if(i!=output.end())
+ fail(format("Extra error line: %s", extract_line(output, i)));
+ if(j!=expected.end())
+ fail(format("Missing error line: %s", extract_line(expected, j)));
+}
+
+string GlslCompilerTest::extract_line(const string &text, const string::const_iterator &iter)
+{
+ string::const_iterator begin = iter;
+ for(; (begin!=text.begin() && *begin!='\n'); --begin) ;
+ if(*begin=='\n')
+ ++begin;
+ string::const_iterator end = iter;
+ for(; (end!=text.end() && *end!='\n'); ++end) ;
+ return string(begin, end);