xcpretty-security-patched 0.3.0

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.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.hound.yml +2 -0
  4. data/.kick +17 -0
  5. data/.rubocop.yml +239 -0
  6. data/.travis.yml +12 -0
  7. data/CHANGELOG.md +269 -0
  8. data/CONTRIBUTING.md +64 -0
  9. data/Gemfile +9 -0
  10. data/LICENSE.txt +61 -0
  11. data/README.md +95 -0
  12. data/Rakefile +18 -0
  13. data/assets/report.html.erb +173 -0
  14. data/bin/xcpretty +90 -0
  15. data/features/assets/RACCommandSpec_enabled_signal_should_send_YES_while_executing_is_YES.png +0 -0
  16. data/features/assets/apple_raw.png +0 -0
  17. data/features/custom_formatter.feature +15 -0
  18. data/features/custom_reporter.feature +29 -0
  19. data/features/fixtures/xcodebuild.log +5963 -0
  20. data/features/html_report.feature +54 -0
  21. data/features/json_compilation_database_report.feature +33 -0
  22. data/features/junit_report.feature +49 -0
  23. data/features/knock_format.feature +11 -0
  24. data/features/simple_format.feature +238 -0
  25. data/features/steps/custom_reporter_steps.rb +16 -0
  26. data/features/steps/formatting_steps.rb +386 -0
  27. data/features/steps/html_steps.rb +32 -0
  28. data/features/steps/json_steps.rb +45 -0
  29. data/features/steps/junit_steps.rb +39 -0
  30. data/features/steps/report_steps.rb +27 -0
  31. data/features/steps/xcpretty_steps.rb +31 -0
  32. data/features/support/env.rb +123 -0
  33. data/features/tap_format.feature +31 -0
  34. data/features/test_format.feature +49 -0
  35. data/features/xcpretty.feature +14 -0
  36. data/lib/xcpretty/ansi.rb +72 -0
  37. data/lib/xcpretty/formatters/formatter.rb +200 -0
  38. data/lib/xcpretty/formatters/knock.rb +35 -0
  39. data/lib/xcpretty/formatters/rspec.rb +33 -0
  40. data/lib/xcpretty/formatters/simple.rb +200 -0
  41. data/lib/xcpretty/formatters/tap.rb +40 -0
  42. data/lib/xcpretty/parser.rb +596 -0
  43. data/lib/xcpretty/printer.rb +28 -0
  44. data/lib/xcpretty/reporters/html.rb +93 -0
  45. data/lib/xcpretty/reporters/json_compilation_database.rb +51 -0
  46. data/lib/xcpretty/reporters/junit.rb +102 -0
  47. data/lib/xcpretty/reporters/reporter.rb +62 -0
  48. data/lib/xcpretty/snippet.rb +38 -0
  49. data/lib/xcpretty/syntax.rb +58 -0
  50. data/lib/xcpretty/term.rb +14 -0
  51. data/lib/xcpretty/version.rb +4 -0
  52. data/lib/xcpretty.rb +38 -0
  53. data/spec/fixtures/NSStringTests.m +64 -0
  54. data/spec/fixtures/constants.rb +707 -0
  55. data/spec/fixtures/custom_formatter.rb +18 -0
  56. data/spec/fixtures/custom_reporter.rb +30 -0
  57. data/spec/fixtures/oneliner.m +1 -0
  58. data/spec/fixtures/raw_kiwi_compilation_fail.txt +24 -0
  59. data/spec/fixtures/raw_kiwi_fail.txt +1896 -0
  60. data/spec/fixtures/raw_specta_fail.txt +3110 -0
  61. data/spec/spec_helper.rb +7 -0
  62. data/spec/support/matchers/colors.rb +21 -0
  63. data/spec/xcpretty/ansi_spec.rb +47 -0
  64. data/spec/xcpretty/formatters/formatter_spec.rb +151 -0
  65. data/spec/xcpretty/formatters/rspec_spec.rb +56 -0
  66. data/spec/xcpretty/formatters/simple_spec.rb +178 -0
  67. data/spec/xcpretty/parser_spec.rb +636 -0
  68. data/spec/xcpretty/printer_spec.rb +55 -0
  69. data/spec/xcpretty/reporters/junit_spec.rb +20 -0
  70. data/spec/xcpretty/reporters/reporter_spec.rb +40 -0
  71. data/spec/xcpretty/snippet_spec.rb +46 -0
  72. data/spec/xcpretty/syntax_spec.rb +39 -0
  73. data/spec/xcpretty/term_spec.rb +26 -0
  74. data/xcpretty.gemspec +37 -0
  75. metadata +250 -0
@@ -0,0 +1,7 @@
1
+ $LOAD_PATH.unshift('.', __FILE__)
2
+ require "lib/xcpretty/ansi"
3
+ require "support/matchers/colors"
4
+ require "fixtures/constants"
5
+
6
+ include XCPretty::ANSI
7
+
@@ -0,0 +1,21 @@
1
+ require 'rspec' unless Object.const_defined? :RSpec
2
+
3
+ RSpec::Matchers.define :be_colored do |expected|
4
+
5
+ def effects_string(actual)
6
+ effects = applied_effects(actual).join(' and ')
7
+ effects.length > 0 ? effects : "unformatted"
8
+ end
9
+
10
+ match do |actual|
11
+ applied_effects(actual).include? expected.to_sym
12
+ end
13
+
14
+ failure_message_for_should do |actual|
15
+ "expected that '#{strip(actual)}' would be colored #{expected}, but was #{effects_string(actual)}"
16
+ end
17
+ failure_message_for_should_not do |actual|
18
+ "expected that #{strip(actual)} would not be colored #{expected}, but was #{effects_string(actual)}"
19
+ end
20
+ end
21
+
@@ -0,0 +1,47 @@
1
+ require "xcpretty/ansi"
2
+
3
+ module XCPretty
4
+ describe ANSI do
5
+ include ANSI
6
+
7
+ before do
8
+ self.colorize = true
9
+ @text = "This is the PARTY"
10
+ end
11
+
12
+ describe "color helpers" do
13
+ it "colors text red" do
14
+ red(@text).should == "\e[31m#{@text}\e[0m"
15
+ end
16
+
17
+ it "formats text bold" do
18
+ white(@text).should == "\e[39;1m#{@text}\e[0m"
19
+ end
20
+
21
+ it "colors text green" do
22
+ green(@text).should == "\e[32;1m#{@text}\e[0m"
23
+ end
24
+
25
+ it "colors text cyan" do
26
+ cyan(@text).should == "\e[36m#{@text}\e[0m"
27
+ end
28
+ end
29
+
30
+ describe "custom color mixing" do
31
+ it "can mix random known colors" do
32
+ ansi_parse(@text, :yellow, :underline).should == "\e[33;4m#{@text}\e[0m"
33
+ end
34
+ end
35
+
36
+ describe "debug helpers" do
37
+ it "can remove formatting from text" do
38
+ strip("\e[33;4m#{@text}\e[0m").should == @text
39
+ end
40
+
41
+ it "can list known applied effects" do
42
+ applied_effects("\e[33;1m#{@text}\e[0m").should == [:yellow, :bold]
43
+ end
44
+ end
45
+ end
46
+ end
47
+
@@ -0,0 +1,151 @@
1
+ # encoding: utf-8
2
+
3
+ require 'xcpretty'
4
+ require 'fixtures/constants'
5
+
6
+ module XCPretty
7
+
8
+ describe Formatter do
9
+
10
+ before(:each) do
11
+ @formatter = Formatter.new(true, true)
12
+ end
13
+
14
+ it "initializes with unicode" do
15
+ @formatter.use_unicode?.should == true
16
+ end
17
+
18
+ it "initializes with color" do
19
+ @formatter.colorize?.should == true
20
+ end
21
+
22
+ it "outputs to new lines by default" do
23
+ @formatter.optional_newline.should == "\n"
24
+ end
25
+
26
+ it "formats cocoapods errors" do
27
+ @formatter.format_error("The sandbox is not in sync...").should ==
28
+ "\n#{@formatter.red("❌ The sandbox is not in sync...")}\n\n"
29
+ end
30
+
31
+ it "formats compiling errors" do
32
+ @formatter.format_compile_error("file", "path/to/file", "expected valid syntax",
33
+ "[a should",
34
+ " ^").should ==
35
+ %Q(
36
+ #{@formatter.red('❌ ')}path/to/file: #{@formatter.red("expected valid syntax")}
37
+
38
+ [a should
39
+ #{@formatter.cyan(" ^")}
40
+
41
+ )
42
+ end
43
+
44
+ it "formats file missing errors" do
45
+ @formatter.format_file_missing_error("error: no such file or directory:",
46
+ "/path/to/file.swift").should ==
47
+ "\n#{@formatter.red(
48
+ '❌ error: no such file or directory:'
49
+ )} /path/to/file.swift\n\n"
50
+ end
51
+
52
+ it "formats compiling warnings" do
53
+ reason = "format specifies type 'id' but the argument has type 'int' [-Wformat]"
54
+
55
+ @formatter.format_compile_warning("file", "path/to/file", reason,
56
+ %Q( NSLog(@"alsdkflsakdj %@", 1);),
57
+ %Q( ~~ ^)).should ==
58
+
59
+ %Q(
60
+ #{@formatter.yellow('⚠️ ')}path/to/file: #{@formatter.yellow(reason)}
61
+
62
+ NSLog(@"alsdkflsakdj %@", 1);
63
+ #{@formatter.cyan(" ~~ ^")}
64
+
65
+ )
66
+ end
67
+
68
+ it "formats linker warnings" do
69
+ @formatter.format_ld_warning("ld: embedded dylibs/frameworks only run on iOS 8 or later").should ==
70
+ "#{@formatter.yellow("⚠️ ld: embedded dylibs/frameworks only run on iOS 8 or later")}"
71
+ end
72
+
73
+ it "formats linker undefined symbols by default" do
74
+ @formatter.format_undefined_symbols("Undefined symbols for architecture x86_64",
75
+ '_OBJC_CLASS_$_CABasicAnimation',
76
+ 'objc-class-ref in ATZRadialProgressControl.o').should == %Q(
77
+ #{@formatter.red("❌ Undefined symbols for architecture x86_64")}
78
+ > Symbol: _OBJC_CLASS_$_CABasicAnimation
79
+ > Referenced from: objc-class-ref in ATZRadialProgressControl.o
80
+
81
+ )
82
+ end
83
+
84
+ it "formats linker duplicate symbols by default" do
85
+ @formatter.format_duplicate_symbols("duplicate symbol _OBJC_IVAR_$ClassName._ivarName in",
86
+ ['/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/ClassName.o',
87
+ '/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Products/Debug-iphonesimulator/libPods.a(DuplicateClassName.o)']).should == %Q(
88
+ #{@formatter.red("❌ duplicate symbol _OBJC_IVAR_$ClassName._ivarName in")}
89
+ > ClassName.o
90
+ > libPods.a(DuplicateClassName.o)
91
+ )
92
+ end
93
+
94
+ it "formats will not be code signed warnings" do
95
+ @formatter.format_will_not_be_code_signed(SAMPLE_WILL_NOT_BE_CODE_SIGNED).should == "#{@formatter.yellow("⚠️ FrameworkName will not be code signed because its settings don't specify a development team.")}"
96
+ end
97
+
98
+
99
+ it "formats failures per suite" do
100
+ Syntax.stub(:highlight) { |snippet| snippet.contents }
101
+
102
+ first_path = File.expand_path('spec/fixtures/NSStringTests.m:46')
103
+ second_path = File.expand_path('spec/fixtures/NSStringTests.m:57')
104
+
105
+ failures = {
106
+ 'CarSpec' => [{
107
+ file_path: first_path,
108
+ reason: "just doesn't work",
109
+ test_case: 'Starting the car'
110
+ }],
111
+ 'StringSpec' => [{
112
+ file_path: second_path,
113
+ reason: "doesn't split",
114
+ test_case: 'Splitting the string'
115
+ }],
116
+ 'UI spec' => [{
117
+ file_path: "<unknown.m>:0",
118
+ reason: "ui test failed",
119
+ test_case: 'yolo'
120
+ }]
121
+ }
122
+ @formatter.format_test_summary(SAMPLE_EXECUTED_TESTS, failures).should == %Q(
123
+
124
+ CarSpec
125
+ Starting the car, #{@formatter.red("just doesn't work")}
126
+ #{@formatter.cyan(first_path)}
127
+ ```
128
+ it(@"converts snake_cased to CamelCased", ^{
129
+ [[[@"snake_case" camelCase] should] equal:@"SnakeCase"];
130
+ });
131
+ ```
132
+
133
+ StringSpec
134
+ Splitting the string, #{@formatter.red("doesn't split")}
135
+ #{@formatter.cyan(second_path)}
136
+ ```
137
+ it(@"-strip strips whitespaces and newlines from both ends", ^{
138
+ [[[@" Look mo, no empties! " strip] should] equal:@"Look mo, no empties!"];
139
+ });
140
+ ```
141
+
142
+ UI spec
143
+ yolo, #{@formatter.red("ui test failed")}
144
+ #{@formatter.cyan("<unknown.m>:0")}
145
+
146
+
147
+ #{@formatter.red(SAMPLE_EXECUTED_TESTS)})
148
+ end
149
+ end
150
+ end
151
+
@@ -0,0 +1,56 @@
1
+ require "spec_helper"
2
+ require "xcpretty"
3
+ require "xcpretty/formatters/rspec"
4
+
5
+ module XCPretty
6
+
7
+ describe RSpec do
8
+
9
+ before(:each) do
10
+ @formatter = RSpec.new(false, false)
11
+ end
12
+
13
+ it "prints dots in the same line" do
14
+ @formatter.optional_newline.should == ""
15
+ end
16
+
17
+ context "without colors" do
18
+
19
+ it "prints dots for passing tests" do
20
+ @formatter.format_passing_test("sweez testz", "sample spec", "0.002").should == "."
21
+ end
22
+
23
+ it "prints P for pending tests" do
24
+ @formatter.format_pending_test("sweez testz", "sample spec").should == "P"
25
+ end
26
+
27
+ it "prints F for failing tests" do
28
+ @formatter.format_failing_test(
29
+ "///file", "NSNumber Specs", "adding numbers", "should add 2 numbers"
30
+ ).should == "F"
31
+ end
32
+ end
33
+
34
+ context "with colors" do
35
+
36
+ before { @formatter.colorize = true }
37
+
38
+ it "prints green for passing tests" do
39
+ @formatter.format_passing_test("sweez testz", "sample spec", "0.002"
40
+ ).should be_colored :green
41
+ end
42
+
43
+ it "prints yellow for pending tests" do
44
+ @formatter.format_pending_test("sweez testz", "sample spec"
45
+ ).should be_colored :yellow
46
+ end
47
+
48
+ it "prints red for failing tests" do
49
+ @formatter.format_failing_test(
50
+ "///file", "NSNumber Specs", "adding numbers", "should add 2 numbers"
51
+ ).should be_colored :red
52
+ end
53
+ end
54
+ end
55
+ end
56
+
@@ -0,0 +1,178 @@
1
+ require 'xcpretty/formatters/formatter'
2
+ require "xcpretty/formatters/simple"
3
+ require "fixtures/constants"
4
+
5
+ module XCPretty
6
+
7
+ describe Simple do
8
+
9
+ before(:each) do
10
+ @formatter = Simple.new(false, false)
11
+ end
12
+
13
+ it "formats analyzing" do
14
+ @formatter.format_analyze("CCChip8DisplayView.m", 'path/to/file').should ==
15
+ "> Analyzing CCChip8DisplayView.m"
16
+ end
17
+
18
+ it "formats build target/project/configuration with target" do
19
+ @formatter.format_build_target("The Spacer", "Pods", "Debug").should ==
20
+ "> Building Pods/The Spacer [Debug]"
21
+ end
22
+
23
+ it "formats build target/project/configuration with target" do
24
+ @formatter.format_aggregate_target("Be Aggro", "AggregateExample", "Debug").should ==
25
+ "> Aggregate AggregateExample/Be Aggro [Debug]"
26
+ end
27
+
28
+ it "formats analyze target/project/configuration with target" do
29
+ @formatter.format_analyze_target("The Spacer", "Pods", "Debug").should ==
30
+ "> Analyzing Pods/The Spacer [Debug]"
31
+ end
32
+
33
+ it "formats clean target/project/configuration" do
34
+ @formatter.format_clean_target("Pods-ObjectiveSugar", "Pods", "Debug").should ==
35
+ "> Cleaning Pods/Pods-ObjectiveSugar [Debug]"
36
+ end
37
+
38
+ it 'formats compiler warnings' do
39
+ warning = 'warning: stuff is broken'
40
+ @formatter.format_warning(warning).should == ' ' + warning
41
+ end
42
+
43
+ it "formats compiling output" do
44
+ @formatter.format_compile("NSMutableArray+ObjectiveSugar.m", 'path/to/file').should ==
45
+ "> Compiling NSMutableArray+ObjectiveSugar.m"
46
+ end
47
+
48
+ it "formats compiling xib output" do
49
+ @formatter.format_compile_xib("MainMenu.xib", 'path/to/file').should ==
50
+ "> Compiling MainMenu.xib"
51
+ end
52
+
53
+ it "formats compiling storyboard output" do
54
+ @formatter.format_compile_xib("Main.storyboard", 'path/to/file').should ==
55
+ "> Compiling Main.storyboard"
56
+ end
57
+
58
+ it 'formats copying header files' do
59
+ @formatter.format_copy_header_file('Source.h',
60
+ 'dir/Destination.h').should == '> Copying Source.h'
61
+ end
62
+
63
+ it 'formats copying plist files' do
64
+ @formatter.format_copy_plist_file("Source.plist",
65
+ 'dir/Destination.plist').should == '> Copying Source.plist'
66
+ end
67
+
68
+ it "formats copy resource" do
69
+ @formatter.format_cpresource("ObjectiveSugar/Default-568h@2x.png").should ==
70
+ "> Copying ObjectiveSugar/Default-568h@2x.png"
71
+ end
72
+
73
+ it "formats Copy strings file" do
74
+ @formatter.format_copy_strings_file("InfoPlist.strings").should ==
75
+ "> Copying InfoPlist.strings"
76
+ end
77
+
78
+ it "formats GenerateDSYMFile" do
79
+ @formatter.format_generate_dsym("ObjectiveSugarTests.octest.dSYM").should ==
80
+ "> Generating 'ObjectiveSugarTests.octest.dSYM'"
81
+ end
82
+
83
+ it "formats info.plist processing" do
84
+ @formatter.format_process_info_plist("The Spacer-Info.plist", "The Spacer/The Spacer-Info.plist").should ==
85
+ "> Processing The Spacer-Info.plist"
86
+ end
87
+
88
+ it "formats Linking" do
89
+ @formatter.format_linking("ObjectiveSugar", 'normal', 'i386').should ==
90
+ "> Linking ObjectiveSugar"
91
+ end
92
+
93
+ it "formats Libtool" do
94
+ @formatter.format_libtool("libPods-ObjectiveSugarTests-Kiwi.a").should ==
95
+ "> Building library libPods-ObjectiveSugarTests-Kiwi.a"
96
+ end
97
+
98
+ it "formats failing tests" do
99
+ @formatter.format_failing_test("RACCommandSpec", "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES", "expected: 1, got: 0", 'path/to/file').should ==
100
+ " x enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES, expected: 1, got: 0"
101
+ end
102
+
103
+ it "formats passing tests" do
104
+ @formatter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001").should ==
105
+ " . _tupleByAddingObject__should_add_a_non_nil_object (0.001 seconds)"
106
+ end
107
+
108
+ it "formats pending tests" do
109
+ @formatter.format_pending_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object").should ==
110
+ " P _tupleByAddingObject__should_add_a_non_nil_object [PENDING]"
111
+ end
112
+
113
+ it "formats measuring tests" do
114
+ @formatter.format_measuring_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001").should ==
115
+ " T _tupleByAddingObject__should_add_a_non_nil_object measured (0.001 seconds)"
116
+ end
117
+
118
+ it "formats build success output" do
119
+ @formatter.format_phase_success("BUILD").should == "> Build Succeeded"
120
+ end
121
+
122
+ it "formats clean success output" do
123
+ @formatter.format_phase_success("CLEAN").should == "> Clean Succeeded"
124
+ end
125
+
126
+ it "formats Phase Script Execution" do
127
+ @formatter.format_phase_script_execution("Check Pods Manifest.lock").should ==
128
+ "> Running script 'Check Pods Manifest.lock'"
129
+ end
130
+
131
+ it "formats precompiling output" do
132
+ @formatter.format_process_pch("Pods-CocoaLumberjack-prefix.pch").should ==
133
+ "> Precompiling Pods-CocoaLumberjack-prefix.pch"
134
+ end
135
+
136
+ it "formats code signing" do
137
+ @formatter.format_codesign("build/Release/CocoaChip.app").should ==
138
+ "> Signing build/Release/CocoaChip.app"
139
+ end
140
+
141
+ it "formats preprocessing a file" do
142
+ @formatter.format_preprocess("CocoaChip/CocoaChip-Info.plist").should ==
143
+ "> Preprocessing CocoaChip/CocoaChip-Info.plist"
144
+ end
145
+
146
+ it "formats PBXCp" do
147
+ @formatter.format_pbxcp("build/Release/CocoaChipCore.framework").should ==
148
+ "> Copying build/Release/CocoaChipCore.framework"
149
+ end
150
+
151
+ it "formats test run start" do
152
+ @formatter.format_test_run_started("ReactiveCocoaTests.octest(Tests)").should ==
153
+ "Test Suite ReactiveCocoaTests.octest(Tests) started"
154
+ end
155
+
156
+ it "formats tests suite started" do
157
+ @formatter.format_test_suite_started("RACKVOWrapperSpec").should ==
158
+ "RACKVOWrapperSpec"
159
+ end
160
+
161
+ it "formats Touch" do
162
+ @formatter.format_touch("/path/to/SomeFile.txt", "SomeFile.txt").should ==
163
+ "> Touching SomeFile.txt"
164
+ end
165
+
166
+ it "formats TiffUtil" do
167
+ @formatter.format_tiffutil("unbelievable.tiff").should ==
168
+ "> Validating unbelievable.tiff"
169
+ end
170
+
171
+ it 'formats Check Dependencies' do
172
+ @formatter.format_check_dependencies.should ==
173
+ '> Check Dependencies'
174
+ end
175
+
176
+ end
177
+ end
178
+