xctest_list 1.0.0 → 1.1.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 +4 -4
  2. data/lib/xctest_list.rb +10 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aeb06d21421204888562b72281a9fb7efd691324
4
- data.tar.gz: 17212dbff04fe9604bfd1dd901109165f01ca79c
3
+ metadata.gz: e05b2f3684347fb874457cba8b36d4e6c9cf6802
4
+ data.tar.gz: 979539b74160fd8b3cbbe4b163b505e03ff9ceda
5
5
  SHA512:
6
- metadata.gz: f3845223a72733c488073e4a441f6bf74a1aa916b60f22aa4b74d3941021605589e2f0c8211ce6e7454ccdd3b4a5a4e08e9fb207526f1403ca0e68f3e361e64f
7
- data.tar.gz: 706b3f8803ab8898221cf5ccefc8b4cd5c5219d486096df1d0e4c7846f0dcfb2a8012943dc62ee67eb81c7baf6396df8d31e87c2756135831b9f3a33f2711a5d
6
+ metadata.gz: 513cf3e9e66e30b1daea52caa7f0d3a9025024ef03c818574465fe67486fca72cf079607f57ecc90f2b0206c475b58177a6c57638d6ea3a387e75f931233b626
7
+ data.tar.gz: c41082180e27dee4d6f4c721745ea5a50b7d297e90f9c7b4ee069562d41da2f7424766413e61776600c00e27c521c07022dbfca5365f76f2fe08dd71c2a016a6
data/lib/xctest_list.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'open3'
2
+ require 'tempfile'
1
3
 
2
4
  # A class to parse xctest bundles and return a list of tests that
3
5
  # are in the bundle's binary.
@@ -33,11 +35,14 @@ class XCTestList
33
35
  objc_symbols_cmd << "'#{binary_path(xctest_bundle_path)}'"
34
36
 
35
37
  tests = []
36
- system(objc_symbols_cmd).each_line do |line|
38
+ Open3.popen2e(objc_symbols_cmd) do |stdin, io, thread|
39
+ io.sync = true
40
+ io.each do |line|
37
41
  if / t -\[(?<testclass>\w+) (?<testmethod>test\w+)\]/ =~ line
38
42
  tests << "#{testclass}/#{testmethod}"
39
43
  end
40
44
  end
45
+ end
41
46
  tests
42
47
  end
43
48
 
@@ -48,10 +53,11 @@ class XCTestList
48
53
 
49
54
  # find the Swift symbols in the bundle's binary
50
55
  def self.swift_tests(xctest_bundle_path)
51
- swift_symbols_cmd_output = system("nm -gU '#{binary_path(xctest_bundle_path)}'")
56
+ swift_symbols_command_output_tempfile = Tempfile.new(File.basename(xctest_bundle_path))
57
+ system("nm -gU '#{binary_path(xctest_bundle_path)}' > '#{swift_symbols_command_output_tempfile.path}'")
52
58
  tests = []
53
- swift_symbols(swift_symbols_cmd_output).each_line do |symbol|
54
- if /\w+\.(?<testclass>[^\.]+)\.(?<testmethod>test[^\(]+)/ =~ system("xcrun swift-demangle #{symbol}")
59
+ File.open(swift_symbols_command_output_tempfile.path, 'r').each do |line|
60
+ if /\w+\.(?<testclass>[^\.]+)\.(?<testmethod>test[^\(]+)/ =~ system("xcrun swift-demangle #{line}")
55
61
  tests << "#{testclass}/#{testmethod}"
56
62
  end
57
63
  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.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lyndsey Ferguson