xctest_list 1.1.8 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/xctest_list.rb +14 -12
  3. metadata +2 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5a7d0c055a03cda79275c01577654e053bb2c163
4
- data.tar.gz: f6b493f6952fdaa84dd40b56b3d357862c0110cf
2
+ SHA256:
3
+ metadata.gz: 5ba4ec13aa03904dd67add015a892024392888ca2249507a4374dba75e877ea6
4
+ data.tar.gz: 3e2e5a315360be63e4b4811f7d9cc49163ccefc56a00b806b98665928d2ad8a2
5
5
  SHA512:
6
- metadata.gz: cf6ad5c2bc5523de91e8562257611881785cf3fe74cb1412fad6e216162034e91dc122bcdab13fc93b3147707bf328f7ef971ac914722f009cd12616c772347c
7
- data.tar.gz: f215babcbf9d8d949af6389234ce67f7e44b801152d8105e79ce43321207b88e43c6564409a85d6efa00acfde967f36fe873f7c0f7bc253124db850d3cbac7c9
6
+ metadata.gz: 4e92a404299ddbfaa80402f7e44463eb17e4c98f6655ce8f93766682377ec89baa2847a85e37b68abe7ca60f62815ffbd7aba7353bc9337ad20675299c65e84d
7
+ data.tar.gz: ee4c4972c09a280f787521cd655ae603883d4c5fb0ca80ead55bc2ec322cafa93d9cb1cc454fb505d7ba226640e9ad6d24e6b65863b4c2635685ad1ece41977e
@@ -35,48 +35,50 @@ class XCTestList
35
35
  end
36
36
 
37
37
  # find the Objective-C symbols in the bundle's binary
38
- def self.objc_tests(xctest_bundle_path)
38
+ def self.objc_tests(xctest_bundle_path, test_prefix: "test")
39
39
  tests = []
40
40
  objc_symbols_command_output_tempfile = Tempfile.new(File.basename(xctest_bundle_path) + "objc")
41
41
  system("nm -U '#{binary_path(xctest_bundle_path)}' > '#{objc_symbols_command_output_tempfile.path}'")
42
42
  tests = []
43
43
  File.foreach(objc_symbols_command_output_tempfile.path) do |line|
44
- if / t -\[(?<testclass>\w+) (?<testmethod>test\w*)\]/ =~ line
45
- tests << "#{testclass}/#{testmethod}"
44
+ regex = / t -\[(?<testclass>\w+) (?<testmethod>#{test_prefix}\w*)\]/
45
+ if (matches = regex.match(line))
46
+ tests << "#{matches[:testclass]}/#{matches[:testmethod]}"
46
47
  end
47
48
  end
48
49
  tests
49
50
  end
50
51
 
51
52
  # cleanup the Swift nm output to only provide the swift symbols
52
- def self.swift_symbols(swift_symbols_cmd_output)
53
+ def self.swift_symbols(swift_symbols_cmd_output, test_prefix: "test")
53
54
  swift_symbols_cmd_output.gsub(/^.* .* (.*)$/, '\1')
54
55
  end
55
56
 
56
- def self.swift_symbol_dump_command(xctest_binary_path)
57
+ def self.swift_symbol_dump_command(xctest_binary_path, test_prefix: "test")
57
58
  nm_version_string = `nm -version | head -n 1 | sed -E 's/Apple LLVM version ([0-9]+\.[0-9]+\.[0-9]+).*/\\1/'`.chomp
58
59
  if Gem::Version.new(nm_version_string) < Gem::Version.new('9.0.0')
59
60
  "nm -gU '#{xctest_binary_path}' | cut -d' ' -f3 | xcrun swift-demangle | grep -E '^\\S+\\.test[^.]+\\(\\)$' | sed 's/ () -> ()/()/'"
60
61
  else
61
- "nm -gU '#{xctest_binary_path}' | cut -d' ' -f3 | xargs -s 131072 xcrun swift-demangle | cut -d' ' -f3 | grep -e '[\\.|_]'test"
62
+ "nm -gU '#{xctest_binary_path}' | cut -d' ' -f3 | xargs -s 131072 xcrun swift-demangle | cut -d' ' -f3 | grep -e '[\\.|_]'#{test_prefix}"
62
63
  end
63
64
  end
64
65
 
65
66
  # find the Swift symbols in the bundle's binary
66
- def self.swift_tests(xctest_bundle_path)
67
+ def self.swift_tests(xctest_bundle_path, test_prefix: "test")
67
68
  swift_symbols_command_output_tempfile = Tempfile.new(File.basename(xctest_bundle_path) + "swift")
68
- system("#{swift_symbol_dump_command(binary_path(xctest_bundle_path))} > '#{swift_symbols_command_output_tempfile.path}'")
69
+ system("#{swift_symbol_dump_command(binary_path(xctest_bundle_path), test_prefix: test_prefix)} > '#{swift_symbols_command_output_tempfile.path}'")
69
70
  tests = []
70
71
  File.foreach(swift_symbols_command_output_tempfile.path) do |line|
71
- if /.*-\[.*\]/ !~ line && /\w+\.(?<testclass>[^\.]+)\.(?<testmethod>test[^\(]*)\(/ =~ line
72
- tests << "#{testclass}/#{testmethod}"
72
+ regex = /\w+\.(?<testclass>[^\.]+)\.(?<testmethod>#{test_prefix}[^\(]*)\(/
73
+ if /.*-\[.*\]/ !~ line && (matches = regex.match(line))
74
+ tests << "#{matches[:testclass]}/#{matches[:testmethod]}"
73
75
  end
74
76
  end
75
77
  tests
76
78
  end
77
79
 
78
80
  # find the Objective-C and Swift tests in the binary's bundle
79
- def self.tests(xctest_bundle_path)
80
- objc_tests(xctest_bundle_path) | swift_tests(xctest_bundle_path)
81
+ def self.tests(xctest_bundle_path, test_prefix: 'test')
82
+ objc_tests(xctest_bundle_path, test_prefix: test_prefix) | swift_tests(xctest_bundle_path, test_prefix: test_prefix)
81
83
  end
82
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xctest_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson
@@ -50,8 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
50
  - !ruby/object:Gem::Version
51
51
  version: '0'
52
52
  requirements: []
53
- rubyforge_project:
54
- rubygems_version: 2.6.11
53
+ rubygems_version: 3.0.6
55
54
  signing_key:
56
55
  specification_version: 4
57
56
  summary: List the tests in the given xctest bundle