xctest_list 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xctest_list.rb +9 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4457b5c6dfe9911a602919c9432bcd07337f1a2d215731cd0d341e08f3dcebd9
|
4
|
+
data.tar.gz: 81b034564dc89ed742ff3d9c58f61428a0f2e3261cfcca4fb37902320f3a0ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2d17625fd42e57fd259b68095d48f3a6c8a597a74e8aba19f01b94f7b6d3b4d0d98b25b71e5d925a74b9f67a7fed7beca1aa4f88ecf08880aa4aec0d88b0b31
|
7
|
+
data.tar.gz: aa8fb73c6e01b1c96f3a51b310d3a4b378627d03ddd54dc3c0d3dd722b0bb8b4dcdceec3382e9f5e6840a6a483fb80a1d8dd9f10a6a32ba61673cbcca7aa72ad
|
data/lib/xctest_list.rb
CHANGED
@@ -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
|
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
|
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
|
-
|
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 '[\\.|_]'#{
|
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,
|
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),
|
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>#{
|
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,
|
82
|
-
objc_tests(xctest_bundle_path
|
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
|