Class: CppTestHook
- Inherits:
-
Mumukit::Templates::FileHook
- Object
- Mumukit::Templates::FileHook
- CppTestHook
- Defined in:
- lib/test_hook.rb
Instance Method Summary collapse
- #command_line(filename) ⇒ Object
- #compile_file_content(request) ⇒ Object
- #post_process_file(file, result, status) ⇒ Object
- #tempfile_extension ⇒ Object
- #to_structured_result(result) ⇒ Object
Instance Method Details
#command_line(filename) ⇒ Object
10 11 12 |
# File 'lib/test_hook.rb', line 10 def command_line(filename) "runcppunit #{filename}" end |
#compile_file_content(request) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/test_hook.rb', line 30 def compile_file_content(request) <<EOF #include <cppunit/ui/text/TestRunner.h> #include <cppunit/extensions/HelperMacros.h> #{super} int main( int argc, char **argv) { CppUnit::TextUi::TestRunner runner; runner.addTest( MumukiTest::suite() ); runner.run(); return 0; } EOF end |
#post_process_file(file, result, status) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/test_hook.rb', line 14 def post_process_file(file, result, status) if result.include? '!!TEST FINISHED WITH COMPILATION ERROR!!' [Mumukit::ContentType::Markdown.code(result), :errored] else super end end |
#tempfile_extension ⇒ Object
6 7 8 |
# File 'lib/test_hook.rb', line 6 def tempfile_extension '.cpp' end |
#to_structured_result(result) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/test_hook.rb', line 22 def to_structured_result(result) if result.include? '!!!FAILURES!!!' transform(result) else [['All tests passed', :passed]] end end |