Class: JSTestSan::Runner

Inherits:
OSX::NSObject
  • Object
show all
Defined in:
lib/js_test_san/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#did_not_passObject (readonly)

Returns the value of attribute did_not_pass.



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

def did_not_pass
  @did_not_pass
end

#queuedObject (readonly)

Returns the value of attribute queued.



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

def queued
  @queued
end

#test_casesObject (readonly)

Returns the value of attribute test_cases.



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

def test_cases
  @test_cases
end

Instance Method Details

#assertionsObject



27
# File 'lib/js_test_san/runner.rb', line 27

def assertions; sum :assertions end

#errorsObject



29
# File 'lib/js_test_san/runner.rb', line 29

def errors;     sum :errors     end

#failuresObject



28
# File 'lib/js_test_san/runner.rb', line 28

def failures;   sum :failures   end

#finished?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/js_test_san/runner.rb', line 49

def finished?
  @finished
end

#initWithHTMLFiles(html_files) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/js_test_san/runner.rb', line 7

def initWithHTMLFiles(html_files)
  if init
    @test_cases = []
    @test_cases = html_files.map { |file| TestCase.alloc.initWithHTMLFile_delegate(file, self) }
    @queued = @test_cases.dup
    @did_not_pass = []
    
    $stdout.sync = true
    
    self
  end
end

#runObject



20
21
22
23
24
# File 'lib/js_test_san/runner.rb', line 20

def run
  @start_time = Time.now
  @queued.first.run
  OSX::NSApplication.sharedApplication.run
end

#test_case_finished(test_case) ⇒ Object



44
45
46
47
# File 'lib/js_test_san/runner.rb', line 44

def test_case_finished(test_case)
  @queued.delete(test_case)
  @queued.empty? ? finalize : @queued.first.run
end

#test_ran(test) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/js_test_san/runner.rb', line 31

def test_ran(test)
  @did_not_pass << test unless test.state == :passed
  
  print case test.state
  when :passed
    '.'
  when :failed
    'F'
  when :error
    'E'
  end
end

#testsObject



26
# File 'lib/js_test_san/runner.rb', line 26

def tests;      sum :tests      end