Class: AppMap::Depends::TestFileInspector::TestReport

Inherits:
Struct
  • Object
show all
Defined in:
lib/appmap/depends/test_file_inspector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#addedObject

Returns the value of attribute added

Returns:

  • (Object)

    the current value of added



8
9
10
# File 'lib/appmap/depends/test_file_inspector.rb', line 8

def added
  @added
end

#changedObject

Returns the value of attribute changed

Returns:

  • (Object)

    the current value of changed



8
9
10
# File 'lib/appmap/depends/test_file_inspector.rb', line 8

def changed
  @changed
end

#failedObject

Returns the value of attribute failed

Returns:

  • (Object)

    the current value of failed



8
9
10
# File 'lib/appmap/depends/test_file_inspector.rb', line 8

def failed
  @failed
end

#metadata_filesObject

Returns the value of attribute metadata_files

Returns:

  • (Object)

    the current value of metadata_files



8
9
10
# File 'lib/appmap/depends/test_file_inspector.rb', line 8

def 
  @metadata_files
end

#removedObject

Returns the value of attribute removed

Returns:

  • (Object)

    the current value of removed



8
9
10
# File 'lib/appmap/depends/test_file_inspector.rb', line 8

def removed
  @removed
end

Instance Method Details

#clean_appmapsObject

Delete AppMaps which depend on test cases that have been deleted.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/appmap/depends/test_file_inspector.rb', line 33

def clean_appmaps
  return if removed.empty?

  count = .each_with_object(0) do |, count|
     = JSON.parse(File.read())
    source_location = Util.normalize_path(['source_location'])
    appmap_path = File.join(.split('/')[0...-1])
    
    if source_location && removed.member?(source_location)
      Util.delete_appmap(appmap_path)
      count += 1
    end
  end
  count
end

#empty?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/appmap/depends/test_file_inspector.rb', line 24

def empty?
  [ added, removed, changed, failed ].all?(&:empty?)
end

#modified_filesObject



28
29
30
# File 'lib/appmap/depends/test_file_inspector.rb', line 28

def modified_files
  added + changed + failed
end

#reportObject



20
21
22
# File 'lib/appmap/depends/test_file_inspector.rb', line 20

def report
  warn to_s unless empty?
end

#to_sObject



11
12
13
14
15
16
17
18
# File 'lib/appmap/depends/test_file_inspector.rb', line 11

def to_s
  report = []
  report << "Added test files   : #{added.to_a.join(' ')}" unless added.empty?
  report << "Removed test files : #{removed.to_a.join(' ')}" unless removed.empty?
  report << "Changed test files : #{changed.to_a.join(' ')}" unless changed.empty?
  report << "Failed test files  : #{failed.to_a.join(' ')}" unless failed.empty?
  report.compact.join("\n")
end