Class: QsimTestHook

Inherits:
Mumukit::Templates::FileHook
  • Object
show all
Defined in:
lib/test_hook.rb

Instance Method Summary collapse

Instance Method Details

#command_line(filename) ⇒ Object



9
10
11
# File 'lib/test_hook.rb', line 9

def command_line(filename)
  "runqsim #{filename} 6"
end

#compile_file_content(request) ⇒ Object



13
14
15
16
# File 'lib/test_hook.rb', line 13

def compile_file_content(request)
  @examples = parse_test(request)[:examples]
  (super request).strip
end

#execute!(request) ⇒ Object



18
19
20
21
# File 'lib/test_hook.rb', line 18

def execute!(request)
  result, _ = run_file! compile request
  parse_json result
end

#post_process_file(file, result, status) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/test_hook.rb', line 23

def post_process_file(file, result, status)
  output = parse_json result

  case status
    when :passed
      framework.test output, @examples
    when :failed
      [output[:error], :errored]
    else
      [output, status]
  end
end

#tempfile_extensionObject



5
6
7
# File 'lib/test_hook.rb', line 5

def tempfile_extension
  '.qsim'
end