xctest_list 1.2.0 → 1.2.1

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 +4 -4
  2. data/lib/xctest_list.rb +9 -14
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ba4ec13aa03904dd67add015a892024392888ca2249507a4374dba75e877ea6
4
- data.tar.gz: 3e2e5a315360be63e4b4811f7d9cc49163ccefc56a00b806b98665928d2ad8a2
3
+ metadata.gz: 4457b5c6dfe9911a602919c9432bcd07337f1a2d215731cd0d341e08f3dcebd9
4
+ data.tar.gz: 81b034564dc89ed742ff3d9c58f61428a0f2e3261cfcca4fb37902320f3a0ae0
5
5
  SHA512:
6
- metadata.gz: 4e92a404299ddbfaa80402f7e44463eb17e4c98f6655ce8f93766682377ec89baa2847a85e37b68abe7ca60f62815ffbd7aba7353bc9337ad20675299c65e84d
7
- data.tar.gz: ee4c4972c09a280f787521cd655ae603883d4c5fb0ca80ead55bc2ec322cafa93d9cb1cc454fb505d7ba226640e9ad6d24e6b65863b4c2635685ad1ece41977e
6
+ metadata.gz: c2d17625fd42e57fd259b68095d48f3a6c8a597a74e8aba19f01b94f7b6d3b4d0d98b25b71e5d925a74b9f67a7fed7beca1aa4f88ecf08880aa4aec0d88b0b31
7
+ data.tar.gz: aa8fb73c6e01b1c96f3a51b310d3a4b378627d03ddd54dc3c0d3dd722b0bb8b4dcdceec3382e9f5e6840a6a483fb80a1d8dd9f10a6a32ba61673cbcca7aa72ad
@@ -35,13 +35,13 @@ 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, test_prefix: "test")
38
+ def self.objc_tests(xctest_bundle_path)
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
- regex = / t -\[(?<testclass>\w+) (?<testmethod>#{test_prefix}\w*)\]/
44
+ regex = / t -\[(?<testclass>\w+) (?<testmethod>test\w*)\]/
45
45
  if (matches = regex.match(line))
46
46
  tests << "#{matches[:testclass]}/#{matches[:testmethod]}"
47
47
  end
@@ -49,27 +49,22 @@ class XCTestList
49
49
  tests
50
50
  end
51
51
 
52
- # cleanup the Swift nm output to only provide the swift symbols
53
- def self.swift_symbols(swift_symbols_cmd_output, test_prefix: "test")
54
- swift_symbols_cmd_output.gsub(/^.* .* (.*)$/, '\1')
55
- end
56
-
57
- def self.swift_symbol_dump_command(xctest_binary_path, test_prefix: "test")
52
+ def self.swift_symbol_dump_command(xctest_binary_path, swift_test_prefix: "test")
58
53
  nm_version_string = `nm -version | head -n 1 | sed -E 's/Apple LLVM version ([0-9]+\.[0-9]+\.[0-9]+).*/\\1/'`.chomp
59
54
  if Gem::Version.new(nm_version_string) < Gem::Version.new('9.0.0')
60
55
  "nm -gU '#{xctest_binary_path}' | cut -d' ' -f3 | xcrun swift-demangle | grep -E '^\\S+\\.test[^.]+\\(\\)$' | sed 's/ () -> ()/()/'"
61
56
  else
62
- "nm -gU '#{xctest_binary_path}' | cut -d' ' -f3 | xargs -s 131072 xcrun swift-demangle | cut -d' ' -f3 | grep -e '[\\.|_]'#{test_prefix}"
57
+ "nm -gU '#{xctest_binary_path}' | cut -d' ' -f3 | xargs -s 131072 xcrun swift-demangle | cut -d' ' -f3 | grep -e '[\\.|_]'#{swift_test_prefix}"
63
58
  end
64
59
  end
65
60
 
66
61
  # find the Swift symbols in the bundle's binary
67
- def self.swift_tests(xctest_bundle_path, test_prefix: "test")
62
+ def self.swift_tests(xctest_bundle_path, swift_test_prefix: "test")
68
63
  swift_symbols_command_output_tempfile = Tempfile.new(File.basename(xctest_bundle_path) + "swift")
69
- system("#{swift_symbol_dump_command(binary_path(xctest_bundle_path), test_prefix: test_prefix)} > '#{swift_symbols_command_output_tempfile.path}'")
64
+ system("#{swift_symbol_dump_command(binary_path(xctest_bundle_path), swift_test_prefix: swift_test_prefix)} > '#{swift_symbols_command_output_tempfile.path}'")
70
65
  tests = []
71
66
  File.foreach(swift_symbols_command_output_tempfile.path) do |line|
72
- regex = /\w+\.(?<testclass>[^\.]+)\.(?<testmethod>#{test_prefix}[^\(]*)\(/
67
+ regex = /\w+\.(?<testclass>[^\.]+)\.(?<testmethod>#{swift_test_prefix}[^\(]*)\(/
73
68
  if /.*-\[.*\]/ !~ line && (matches = regex.match(line))
74
69
  tests << "#{matches[:testclass]}/#{matches[:testmethod]}"
75
70
  end
@@ -78,7 +73,7 @@ class XCTestList
78
73
  end
79
74
 
80
75
  # find the Objective-C and Swift tests in the binary's bundle
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)
76
+ def self.tests(xctest_bundle_path, swift_test_prefix: 'test')
77
+ objc_tests(xctest_bundle_path) | swift_tests(xctest_bundle_path, swift_test_prefix: swift_test_prefix)
83
78
  end
84
79
  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.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson