@@ -305,6 +305,44 @@ def test_c_compilation_error():
305305 assert actual == expected
306306
307307
308+ def test_cpp_compilation_error ():
309+ original = """In file included from execution_0.cpp:3,
310+ from selector.cpp:5:
311+ submission.cpp:3:1: error: ‘mfzej’ does not name a type
312+ 3 | mfzej àryhg çyh aiogharuio ghqgh
313+ | ^~~~~
314+ In file included from selector.cpp:5:
315+ execution_0.cpp: In function ‘void execution_0_write_separator()’:
316+ execution_0.cpp:9:5: error: ‘execution_0_value_file’ was not declared in this scope; did you mean ‘execution_0_exception_file’?
317+ 9 | execution_0_value_file << "--Nh9YaHPGI-- SEP";
318+ | ^~~~~~~~~~~~~~~~~~~~~~
319+ | execution_0_exception_file
320+ execution_0.cpp: In function ‘void execution_0_write_context_separator()’:
321+ execution_0.cpp:16:5: error: ‘execution_0_value_file’ was not declared in this scope; did you mean ‘execution_0_exception_file’?
322+ 16 | execution_0_value_file << "--xxWjFpcXw-- SEP";
323+ | ^~~~~~~~~~~~~~~~~~~~~~
324+ | execution_0_exception_file
325+ execution_0.cpp: In function ‘int execution_0_context_0()’:
326+ execution_0.cpp:39:25: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
327+ 39 | char* args[] = {"submission", };
328+ | ^~~~~~~~~~~~
329+ execution_0.cpp:40:21: error: ‘solution_main’ was not declared in this scope
330+ 40 | exit_code = solution_main(1, args);
331+ | ^~~~~~~~~~~~~
332+ execution_0.cpp: In function ‘int execution_0()’:
333+ execution_0.cpp:52:5: error: ‘execution_0_value_file’ was not declared in this scope
334+ 52 | execution_0_value_file.open("Nh9YaHPGI_values.txt", std::ios::out);
335+ | ^~~~~~~~~~~~~~~~~~~~~~
336+ """
337+ language_config = get_language ("test" , "cpp" )
338+ expected = """<code>:3:1: error: ‘mfzej’ does not name a type
339+ 3 | mfzej àryhg çyh aiogharuio ghqgh
340+ | ^~~~~
341+ """
342+ actual = language_config .cleanup_stacktrace (original )
343+ assert actual == expected
344+
345+
308346def test_haskell_compilation_error ():
309347 original = """Submission.hs:3:1: error:
310348 Parse error: module header, import declaration
0 commit comments