Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
76d464e9dd |
@ -71,7 +71,7 @@ Rails.application.configure do
|
|||||||
# The `child_src` directive is only a fallback for browsers not supporting `worker_src`.
|
# The `child_src` directive is only a fallback for browsers not supporting `worker_src`.
|
||||||
policy.child_src :self, :blob
|
policy.child_src :self, :blob
|
||||||
policy.form_action :self
|
policy.form_action :self
|
||||||
policy.frame_ancestors :none
|
policy.frame_ancestors :self, 'https://*.htwk-leipzig.de'
|
||||||
policy.frame_src :none
|
policy.frame_src :none
|
||||||
policy.manifest_src :none
|
policy.manifest_src :none
|
||||||
|
|
||||||
|
31
lib/cabal_adapter.rb
Normal file
31
lib/cabal_adapter.rb
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class CabalAdapter < TestingFrameworkAdapter
|
||||||
|
# Regular expressions to extract the number of test suites, test cases, and their status
|
||||||
|
COUNT_REGEXP = /(\d+) of \d+ test suites \((\d+) of \d+ test cases\)/
|
||||||
|
PASS_REGEXP = /passed/
|
||||||
|
FAIL_REGEXP = /failed/
|
||||||
|
|
||||||
|
def self.framework_name
|
||||||
|
'Haskell Cabal'
|
||||||
|
end
|
||||||
|
|
||||||
|
# Parse the output from Cabal test suite
|
||||||
|
def parse_output(output)
|
||||||
|
# Extract the total count of test suites and test cases
|
||||||
|
count_match = output[:stdout].scan(COUNT_REGEXP).last
|
||||||
|
test_cases_count = count_match&.last&.to_i || 0
|
||||||
|
|
||||||
|
# Check if the test suite passed or failed
|
||||||
|
passed = output[:stdout] =~ PASS_REGEXP
|
||||||
|
failed = output[:stdout] =~ FAIL_REGEXP
|
||||||
|
|
||||||
|
if passed
|
||||||
|
{count: test_cases_count, passed: test_cases_count}
|
||||||
|
elsif failed
|
||||||
|
{count: test_cases_count, failed: test_cases_count}
|
||||||
|
else
|
||||||
|
{count: test_cases_count, passed: 0, failed: 0}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user