learn-xcpretty 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.kick +17 -0
  4. data/.travis.yml +18 -0
  5. data/CHANGELOG.md +152 -0
  6. data/CONTRIBUTING.md +60 -0
  7. data/Gemfile +8 -0
  8. data/LICENSE.txt +61 -0
  9. data/README.md +143 -0
  10. data/Rakefile +24 -0
  11. data/assets/report.html.erb +155 -0
  12. data/bin/learn-xcpretty +80 -0
  13. data/features/custom_formatter.feature +15 -0
  14. data/features/fixtures/xcodebuild.log +5963 -0
  15. data/features/html_report.feature +40 -0
  16. data/features/json_compilation_database_report.feature +21 -0
  17. data/features/junit_report.feature +44 -0
  18. data/features/knock_format.feature +11 -0
  19. data/features/simple_format.feature +172 -0
  20. data/features/steps/formatting_steps.rb +268 -0
  21. data/features/steps/html_steps.rb +23 -0
  22. data/features/steps/json_steps.rb +37 -0
  23. data/features/steps/junit_steps.rb +38 -0
  24. data/features/steps/report_steps.rb +21 -0
  25. data/features/steps/xcpretty_steps.rb +31 -0
  26. data/features/support/env.rb +108 -0
  27. data/features/tap_format.feature +31 -0
  28. data/features/test_format.feature +39 -0
  29. data/features/xcpretty.feature +14 -0
  30. data/learn-xcpretty.gemspec +37 -0
  31. data/lib/xcpretty/ansi.rb +71 -0
  32. data/lib/xcpretty/formatters/formatter.rb +134 -0
  33. data/lib/xcpretty/formatters/knock.rb +34 -0
  34. data/lib/xcpretty/formatters/rspec.rb +27 -0
  35. data/lib/xcpretty/formatters/simple.rb +155 -0
  36. data/lib/xcpretty/formatters/tap.rb +39 -0
  37. data/lib/xcpretty/parser.rb +421 -0
  38. data/lib/xcpretty/printer.rb +20 -0
  39. data/lib/xcpretty/reporters/html.rb +73 -0
  40. data/lib/xcpretty/reporters/json_compilation_database.rb +58 -0
  41. data/lib/xcpretty/reporters/junit.rb +99 -0
  42. data/lib/xcpretty/reporters/learn.rb +154 -0
  43. data/lib/xcpretty/snippet.rb +34 -0
  44. data/lib/xcpretty/syntax.rb +20 -0
  45. data/lib/xcpretty/version.rb +3 -0
  46. data/lib/xcpretty.rb +39 -0
  47. data/spec/fixtures/NSStringTests.m +64 -0
  48. data/spec/fixtures/constants.rb +546 -0
  49. data/spec/fixtures/custom_formatter.rb +17 -0
  50. data/spec/fixtures/oneliner.m +1 -0
  51. data/spec/fixtures/raw_kiwi_compilation_fail.txt +24 -0
  52. data/spec/fixtures/raw_kiwi_fail.txt +1896 -0
  53. data/spec/fixtures/raw_specta_fail.txt +3110 -0
  54. data/spec/spec_helper.rb +6 -0
  55. data/spec/support/matchers/colors.rb +20 -0
  56. data/spec/xcpretty/ansi_spec.rb +46 -0
  57. data/spec/xcpretty/formatters/formatter_spec.rb +113 -0
  58. data/spec/xcpretty/formatters/rspec_spec.rb +55 -0
  59. data/spec/xcpretty/formatters/simple_spec.rb +129 -0
  60. data/spec/xcpretty/parser_spec.rb +421 -0
  61. data/spec/xcpretty/printer_spec.rb +53 -0
  62. data/spec/xcpretty/snippet_spec.rb +39 -0
  63. data/spec/xcpretty/syntax_spec.rb +35 -0
  64. data/vendor/json_pure/COPYING +57 -0
  65. data/vendor/json_pure/LICENSE +340 -0
  66. data/vendor/json_pure/generator.rb +443 -0
  67. data/vendor/json_pure/parser.rb +364 -0
  68. metadata +261 -0
@@ -0,0 +1,6 @@
1
+ $:.unshift('.', __FILE__)
2
+ require "lib/xcpretty/ansi"
3
+ require "support/matchers/colors"
4
+ require "fixtures/constants"
5
+
6
+ include XCPretty::ANSI
@@ -0,0 +1,20 @@
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
@@ -0,0 +1,46 @@
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
@@ -0,0 +1,113 @@
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 be_true
16
+ end
17
+
18
+ it "initializes with color" do
19
+ @formatter.colorize?.should be_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 linker undefined symbols by default" do
45
+ @formatter.format_undefined_symbols("Undefined symbols for architecture x86_64",
46
+ '_OBJC_CLASS_$_CABasicAnimation',
47
+ 'objc-class-ref in ATZRadialProgressControl.o').should == %Q(
48
+ #{@formatter.red("⌦ Undefined symbols for architecture x86_64")}
49
+ > Symbol: _OBJC_CLASS_$_CABasicAnimation
50
+ > Referenced from: objc-class-ref in ATZRadialProgressControl.o
51
+
52
+ )
53
+ end
54
+
55
+ it "formats linker duplicate symbols by default" do
56
+ @formatter.format_duplicate_symbols("duplicate symbol _OBJC_IVAR_$ClassName._ivarName in",
57
+ ['/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/ClassName.o',
58
+ '/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Products/Debug-iphonesimulator/libPods.a(DuplicateClassName.o)']).should == %Q(
59
+ #{@formatter.red("⌦ duplicate symbol _OBJC_IVAR_$ClassName._ivarName in")}
60
+ > ClassName.o
61
+ > libPods.a(DuplicateClassName.o)
62
+ )
63
+ end
64
+
65
+
66
+ if RUBY_VERSION > '1.8.7'
67
+ it "formats failures per suite" do
68
+ Syntax.stub(:highlight) { |text| text }
69
+
70
+ first_path = File.expand_path('spec/fixtures/NSStringTests.m:46')
71
+ second_path = File.expand_path('spec/fixtures/NSStringTests.m:57')
72
+
73
+ failures = {
74
+ 'CarSpec' => [
75
+ {
76
+ :file_path => first_path,
77
+ :reason => "just doesn't work",
78
+ :test_case => 'Starting the car'
79
+ }],
80
+ 'StringSpec' => [
81
+ {
82
+ :file_path => second_path,
83
+ :reason => "doesn't split",
84
+ :test_case => 'Splitting the string'
85
+ }]
86
+ }
87
+ @formatter.format_test_summary(SAMPLE_EXECUTED_TESTS, failures).should == %Q(
88
+
89
+ CarSpec
90
+ Starting the car, #{@formatter.red("just doesn't work")}
91
+ #{@formatter.cyan(first_path)}
92
+ ```
93
+ it(@"converts snake_cased to CamelCased", ^{
94
+ [[[@"snake_case" camelCase] should] equal:@"SnakeCase"];
95
+ });
96
+ ```
97
+
98
+ StringSpec
99
+ Splitting the string, #{@formatter.red("doesn't split")}
100
+ #{@formatter.cyan(second_path)}
101
+ ```
102
+ it(@"-strip strips whitespaces and newlines from both ends", ^{
103
+ [[[@" Look mo, no empties! " strip] should] equal:@"Look mo, no empties!"];
104
+ });
105
+ ```
106
+
107
+
108
+ #{@formatter.red(SAMPLE_EXECUTED_TESTS)})
109
+ end
110
+ end # only ruby 1.9 above because of ordered hashes
111
+
112
+ end
113
+ end
@@ -0,0 +1,55 @@
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
@@ -0,0 +1,129 @@
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 clean target/project/configuration" do
24
+ @formatter.format_clean_target("Pods-ObjectiveSugar", "Pods", "Debug").should ==
25
+ "> Cleaning Pods/Pods-ObjectiveSugar [Debug]"
26
+ end
27
+
28
+ it "formats compiling output" do
29
+ @formatter.format_compile("NSMutableArray+ObjectiveSugar.m", 'path/to/file').should ==
30
+ "> Compiling NSMutableArray+ObjectiveSugar.m"
31
+ end
32
+
33
+ it "formats compiling xib output" do
34
+ @formatter.format_compile_xib("MainMenu.xib", 'path/to/file').should ==
35
+ "> Compiling MainMenu.xib"
36
+ end
37
+
38
+ it "formats copy resource" do
39
+ @formatter.format_cpresource("ObjectiveSugar/Default-568h@2x.png").should ==
40
+ "> Copying ObjectiveSugar/Default-568h@2x.png"
41
+ end
42
+
43
+ it "formats Copy strings file" do
44
+ @formatter.format_copy_strings_file("InfoPlist.strings").should ==
45
+ "> Copying InfoPlist.strings"
46
+ end
47
+
48
+ it "formats GenerateDSYMFile" do
49
+ @formatter.format_generate_dsym("ObjectiveSugarTests.octest.dSYM").should ==
50
+ "> Generating 'ObjectiveSugarTests.octest.dSYM'"
51
+ end
52
+
53
+ it "formats info.plist processing" do
54
+ @formatter.format_process_info_plist("The Spacer-Info.plist", "The Spacer/The Spacer-Info.plist").should ==
55
+ "> Processing The Spacer-Info.plist"
56
+ end
57
+
58
+ it "formats Linking" do
59
+ @formatter.format_linking("ObjectiveSugar", 'normal', 'i386').should ==
60
+ "> Linking ObjectiveSugar"
61
+ end
62
+
63
+ it "formats Libtool" do
64
+ @formatter.format_libtool("libPods-ObjectiveSugarTests-Kiwi.a").should ==
65
+ "> Building library libPods-ObjectiveSugarTests-Kiwi.a"
66
+ end
67
+
68
+ it "formats failing tests" do
69
+ @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 ==
70
+ " x enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES, expected: 1, got: 0"
71
+ end
72
+
73
+ it "formats passing tests" do
74
+ @formatter.format_passing_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object", "0.001").should ==
75
+ " . _tupleByAddingObject__should_add_a_non_nil_object (0.001 seconds)"
76
+ end
77
+
78
+ it "formats pending tests" do
79
+ @formatter.format_pending_test("RACCommandSpec", "_tupleByAddingObject__should_add_a_non_nil_object").should ==
80
+ " P _tupleByAddingObject__should_add_a_non_nil_object [PENDING]"
81
+ end
82
+
83
+ it "formats Phase Script Execution" do
84
+ @formatter.format_phase_script_execution("Check Pods Manifest.lock").should ==
85
+ "> Running script 'Check Pods Manifest.lock'"
86
+ end
87
+
88
+ it "formats precompiling output" do
89
+ @formatter.format_process_pch("Pods-CocoaLumberjack-prefix.pch").should ==
90
+ "> Precompiling Pods-CocoaLumberjack-prefix.pch"
91
+ end
92
+
93
+ it "formats code signing" do
94
+ @formatter.format_codesign("build/Release/CocoaChip.app").should ==
95
+ "> Signing build/Release/CocoaChip.app"
96
+ end
97
+
98
+ it "formats preprocessing a file" do
99
+ @formatter.format_preprocess("CocoaChip/CocoaChip-Info.plist").should ==
100
+ "> Preprocessing CocoaChip/CocoaChip-Info.plist"
101
+ end
102
+
103
+ it "formats PBXCp" do
104
+ @formatter.format_pbxcp("build/Release/CocoaChipCore.framework").should ==
105
+ "> Copying build/Release/CocoaChipCore.framework"
106
+ end
107
+
108
+ it "formats test run start" do
109
+ @formatter.format_test_run_started("ReactiveCocoaTests.octest(Tests)").should ==
110
+ "Test Suite ReactiveCocoaTests.octest(Tests) started"
111
+ end
112
+
113
+ it "formats tests suite started" do
114
+ @formatter.format_test_suite_started("RACKVOWrapperSpec").should ==
115
+ "RACKVOWrapperSpec"
116
+ end
117
+
118
+ it "formats Touch" do
119
+ @formatter.format_touch("/path/to/SomeFile.txt","SomeFile.txt").should ==
120
+ "> Touching SomeFile.txt"
121
+ end
122
+
123
+ it "formats TiffUtil" do
124
+ @formatter.format_tiffutil("unbelievable.tiff").should ==
125
+ "> Validating unbelievable.tiff"
126
+ end
127
+
128
+ end
129
+ end
@@ -0,0 +1,421 @@
1
+ # encoding: utf-8
2
+
3
+ require 'xcpretty'
4
+ require 'xcpretty/parser'
5
+ require 'fixtures/constants'
6
+
7
+ module XCPretty
8
+
9
+ describe Parser do
10
+
11
+ before(:each) do
12
+ @formatter = Formatter.new(false, false)
13
+ @parser = Parser.new(@formatter)
14
+ end
15
+
16
+ it "parses analyze" do
17
+ @formatter.should receive(:format_analyze).with("CCChip8DisplayView.m", "CocoaChip/CCChip8DisplayView.m")
18
+ @parser.parse(SAMPLE_ANALYZE)
19
+ end
20
+
21
+ it "parses analyze shallow" do
22
+ @formatter.should receive(:format_analyze).with("CCChip8DisplayView.m", "CocoaChip/CCChip8DisplayView.m")
23
+ @parser.parse(SAMPLE_ANALYZE_SHALLOW)
24
+ end
25
+
26
+ it "parses build target" do
27
+ @formatter.should receive(:format_build_target).with("The Spacer", "Pods", "Debug")
28
+ @parser.parse(SAMPLE_BUILD)
29
+ end
30
+
31
+ it "parses clean remove" do
32
+ @formatter.should receive(:format_clean_remove)
33
+ @parser.parse(SAMPLE_CLEAN_REMOVE)
34
+ end
35
+
36
+ it "parses clean target" do
37
+ @formatter.should receive(:format_clean_target).with("Pods-ObjectiveSugar", "Pods", "Debug")
38
+ @parser.parse(SAMPLE_CLEAN)
39
+ end
40
+
41
+ it "parses clean target withut dash in target name" do
42
+ @formatter.should receive(:format_clean_target).with("Pods", "Pods", "Debug")
43
+ @parser.parse(SAMPLE_ANOTHER_CLEAN)
44
+ end
45
+
46
+ it "parses check dependencies" do
47
+ @formatter.should receive(:format_check_dependencies)
48
+ @parser.parse("Check dependencies")
49
+ end
50
+
51
+ it "parses code signing" do
52
+ @formatter.should receive(:format_codesign).with("build/Release/CocoaChip.app")
53
+ @parser.parse(SAMPLE_CODESIGN)
54
+ end
55
+
56
+ it "parses code signing a framework" do
57
+ @formatter.should receive(:format_codesign).with("build/Release/CocoaChipCore.framework")
58
+ @parser.parse(SAMPLE_CODESIGN_FRAMEWORK)
59
+ end
60
+
61
+ it "parses compiler commands" do
62
+ compile_statement = SAMPLE_ANOTHER_COMPILE.lines().to_a.last()
63
+ @formatter.should receive(:format_compile_command).with(compile_statement.strip())
64
+ @parser.parse(compile_statement)
65
+ end
66
+
67
+ it "parses compiling categories" do
68
+ @formatter.should receive(:format_compile).with("NSMutableArray+ObjectiveSugar.m", "/Users/musalj/code/OSS/ObjectiveSugar/Classes/NSMutableArray+ObjectiveSugar.m")
69
+ @parser.parse(SAMPLE_COMPILE)
70
+ end
71
+
72
+ it "parses compiling classes" do
73
+ @formatter.should receive(:format_compile).with("KWNull.m", "Classes/Core/KWNull.m")
74
+ @parser.parse(SAMPLE_ANOTHER_COMPILE)
75
+ end
76
+
77
+ it "parses compiling Objective-C++ classes" do
78
+ @formatter.should receive(:format_compile).with("KWNull.mm", "Classes/Core/KWNull.mm")
79
+ @parser.parse(SAMPLE_ANOTHER_COMPILE.sub('.m', '.mm'))
80
+ end
81
+
82
+ it "parses compiling C and C++ files" do
83
+ for file_extension in ['.c', '.cc', '.cpp', '.cxx'] do
84
+ @formatter.should receive(:format_compile).with("KWNull" + file_extension, "Classes/Core/KWNull" + file_extension)
85
+ @parser.parse(SAMPLE_ANOTHER_COMPILE.sub('.m', file_extension))
86
+ end
87
+ end
88
+
89
+ it "parses compiling XIBs" do
90
+ @formatter.should receive(:format_compile_xib).with("MainMenu.xib", "CocoaChip/en.lproj/MainMenu.xib")
91
+ @parser.parse(SAMPLE_COMPILE_XIB)
92
+ end
93
+
94
+ it "parses CopyStringsFile" do
95
+ @formatter.should receive(:format_copy_strings_file).with('InfoPlist.strings')
96
+ @parser.parse(SAMPLE_COPYSTRINGS)
97
+ end
98
+
99
+ it "parses CpResource" do
100
+ @formatter.should receive(:format_cpresource).with('ObjectiveSugar/Default-568h@2x.png')
101
+ @parser.parse(SAMPLE_CPRESOURCE)
102
+ end
103
+
104
+ it "parses GenerateDSYMFile" do
105
+ @formatter.should receive(:format_generate_dsym).with('ObjectiveSugarTests.octest.dSYM')
106
+ @parser.parse(SAMPLE_DSYM)
107
+ end
108
+
109
+ it "parses info.plist processing" do
110
+ @formatter.should receive(:format_process_info_plist).with('The Spacer-Info.plist', 'The Spacer/The Spacer-Info.plist')
111
+ @parser.parse(SAMPLE_PROCESS_INFOPLIST)
112
+ end
113
+
114
+ it "parses Ld" do
115
+ @formatter.should receive(:format_linking).with('ObjectiveSugar', 'normal', 'i386')
116
+ @parser.parse(SAMPLE_LD)
117
+ end
118
+
119
+ it "parses Libtool" do
120
+ @formatter.should receive(:format_libtool).with('libPods-ObjectiveSugarTests-Kiwi.a')
121
+ @parser.parse(SAMPLE_LIBTOOL)
122
+ end
123
+
124
+ it "parses specta failing tests" do
125
+ @formatter.should receive(:format_failing_test).with("SKWelcomeViewControllerSpecSpec",
126
+ "SKWelcomeViewController_When_a_user_opens_the_app_from_a_clean_installation_displays_the_welcome_screen",
127
+ "The step timed out after 2.00 seconds: Failed to find accessibility element with the label \"The asimplest way to make smarter business decisions\"",
128
+ "/Users/vickeryj/Code/ipad-register/KIFTests/Specs/SKWelcomeViewControllerSpec.m:11")
129
+ @parser.parse(SAMPLE_SPECTA_FAILURE)
130
+ end
131
+
132
+ it "parses old specta failing tests" do
133
+ @formatter.should receive(:format_failing_test).with("RACCommandSpec",
134
+ "enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES",
135
+ "expected: 1, got: 0",
136
+ "/Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458")
137
+ @parser.parse(SAMPLE_OLD_SPECTA_FAILURE)
138
+ end
139
+
140
+ it "parses passing ocunit tests" do
141
+ @formatter.should receive(:format_passing_test).with('RACCommandSpec',
142
+ 'enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES',
143
+ '0.001')
144
+ @parser.parse(SAMPLE_OCUNIT_TEST)
145
+ end
146
+
147
+ it "parses passing specta tests" do
148
+ @formatter.should receive(:format_passing_test).with('SKWelcomeActivationViewControllerSpecSpec',
149
+ 'SKWelcomeActivationViewController_When_a_user_enters_their_details_lets_them_enter_a_valid_manager_code',
150
+ '0.725')
151
+ @parser.parse(SAMPLE_SPECTA_TEST)
152
+ end
153
+
154
+ it "parses pending tests" do
155
+ @formatter.should receive(:format_pending_test).with('TAPIConversationSpec',
156
+ 'TAPIConversation_createConversation_SendsAPOSTRequestToTheConversationsEndpoint')
157
+ @parser.parse(SAMPLE_PENDING_KIWI_TEST)
158
+ end
159
+
160
+ it "parses PhaseScriptExecution" do
161
+ @formatter.should receive(:format_phase_script_execution).with('Check Pods Manifest.lock')
162
+ @parser.parse(SAMPLE_RUN_SCRIPT)
163
+ end
164
+
165
+ it "parses process PCH" do
166
+ @formatter.should receive(:format_process_pch).with("Pods-CocoaLumberjack-prefix.pch")
167
+ @parser.parse(SAMPLE_PRECOMPILE)
168
+ end
169
+
170
+ it "parses preprocessing" do
171
+ @formatter.should receive(:format_preprocess).with("CocoaChip/CocoaChip-Info.plist")
172
+ @parser.parse(SAMPLE_PREPROCESS)
173
+ end
174
+
175
+ it "parses PBXCp" do
176
+ @formatter.should receive(:format_pbxcp).with("build/Release/CocoaChipCore.framework")
177
+ @parser.parse(SAMPLE_PBXCP)
178
+ end
179
+
180
+ it "parses Touch" do
181
+ @formatter.should receive(:format_touch).with(
182
+ '/Users/musalj/Library/Developer/Xcode/DerivedData/Alcatraz-aobuxcinaqyzjugrnxjjhfzgwaou/Build/Products/Debug/AlcatrazTests.octest',
183
+ 'AlcatrazTests.octest')
184
+ @parser.parse(SAMPLE_TOUCH)
185
+ end
186
+
187
+ it "parses TiffUtil" do
188
+ @formatter.should receive(:format_tiffutil).with('eye_icon.tiff')
189
+ @parser.parse(SAMPLE_TIFFUTIL)
190
+ end
191
+
192
+ it "parses undefined symbols" do
193
+ @formatter.should receive(:format_undefined_symbols).with("Undefined symbols for architecture x86_64",
194
+ '_OBJC_CLASS_$_CABasicAnimation',
195
+ 'objc-class-ref in ATZRadialProgressControl.o')
196
+ SAMPLE_UNDEFINED_SYMBOLS.each_line do |line|
197
+ @parser.parse(line)
198
+ end
199
+ end
200
+
201
+ it "parses duplicate symbols" do
202
+ @formatter.should receive(:format_duplicate_symbols).with(
203
+ "duplicate symbol _OBJC_IVAR_$ClassName._ivarName in",
204
+ [
205
+ '/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/ClassName.o',
206
+ '/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Products/Debug-iphonesimulator/libPods.a(DuplicateClassName.o)'
207
+ ]
208
+ )
209
+ SAMPLE_DUPLICATE_SYMBOLS.each_line do |line|
210
+ @parser.parse(line)
211
+ end
212
+ end
213
+
214
+
215
+
216
+ it "parses ocunit test run finished" do
217
+ @formatter.should receive(:format_test_run_finished).with('ReactiveCocoaTests.octest(Tests)', '2013-12-10 07:03:03 +0000.')
218
+ @parser.parse(SAMPLE_OCUNIT_TEST_RUN_COMPLETION)
219
+ end
220
+
221
+ it "parses specta test run finished" do
222
+ @formatter.should receive(:format_test_run_finished).with('KIFTests.xctest', '2014-02-28 15:44:32 +0000.')
223
+ @parser.parse(SAMPLE_SPECTA_TEST_RUN_COMPLETION)
224
+ end
225
+
226
+ it "parses ocunit test run started" do
227
+ @formatter.should receive(:format_test_run_started).with('ReactiveCocoaTests.octest(Tests)')
228
+ @parser.parse(SAMPLE_OCUNIT_TEST_RUN_BEGINNING)
229
+ end
230
+
231
+ it "parses specta test run started" do
232
+ @formatter.should receive(:format_test_run_started).with('KIFTests.xctest')
233
+ @parser.parse(SAMPLE_SPECTA_TEST_RUN_BEGINNING)
234
+ end
235
+
236
+ it "parses ocunit test suite started" do
237
+ @formatter.should receive(:format_test_suite_started).with('RACKVOWrapperSpec')
238
+ @parser.parse(SAMPLE_OCUNIT_SUITE_BEGINNING)
239
+ end
240
+
241
+ it "parses specta test suite started" do
242
+ @formatter.should receive(:format_test_suite_started).with('All tests')
243
+ @parser.parse(SAMPLE_SPECTA_SUITE_BEGINNING)
244
+ end
245
+
246
+ context "errors" do
247
+
248
+ it "parses clang errors" do
249
+ @formatter.should receive(:format_error).with(SAMPLE_CLANG_ERROR)
250
+ @parser.parse(SAMPLE_CLANG_ERROR)
251
+ end
252
+
253
+ it "parses cocoapods errors" do
254
+ @formatter.should receive(:format_error).with("The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.")
255
+ @parser.parse(SAMPLE_PODS_ERROR)
256
+ end
257
+
258
+ it "parses compiling errors" do
259
+ @formatter.should receive(:format_compile_error).with(
260
+ "SampleTest.m",
261
+ "/Users/musalj/code/OSS/SampleApp/SampleTest.m:12:59",
262
+ "expected identifier",
263
+ " [[thread.lastMessage should] equal:thread.];",
264
+ " ^")
265
+ SAMPLE_COMPILE_ERROR.each_line do |line|
266
+ @parser.parse(line)
267
+ end
268
+ end
269
+
270
+ it 'parses fatal compiling errors' do
271
+ @formatter.should receive(:format_compile_error).with(
272
+ 'SomeRandomClass.h',
273
+ '/Users/musalj/code/OSS/SampleApp/Pods/Headers/LessCoolPod/SomeRandomClass.h:31:9',
274
+ "'SomeRandomHeader.h' file not found",
275
+ '#import "SomeRandomHeader.h"',
276
+ ' ^'
277
+ # For now, it's probably not worth to provide the import stack
278
+ # It'd require more state, and not sure if it'd be any useful
279
+ #%Q(In file included from /Users/musalj/code/OSS/SampleApp/Pods/SuperCoolPod/SuperAwesomeClass.m:12:
280
+ #In file included from /Users/musalj/code/OSS/SampleApp/Pods/../LessCoolPod/LessCoolClass.h:9:
281
+ #In file included from /Users/musalj/code/OSS/SampleApp/Pods/../LessCoolPod/EvenLessCoolClass.h:10:)
282
+ )
283
+ SAMPLE_FATAL_COMPILE_ERROR.each_line do |line|
284
+ @parser.parse(line)
285
+ end
286
+ end
287
+
288
+ it 'parses fatal error: on the beginning of the line for corrupted AST files' do
289
+ @formatter.should receive(:format_error).with(
290
+ "fatal error: malformed or corrupted AST file: 'could not find file '/Users/mpv/dev/project/Crashlytics.framework/Headers/Crashlytics.h' referenced by AST file' note: after modifying system headers, please delete the module cache at '/Users/mpv/Library/Developer/Xcode/DerivedData/ModuleCache/M5WJ0FYE7N06'"
291
+ )
292
+ @parser.parse(SAMPLE_FATAL_HEADER_ERROR)
293
+ end
294
+
295
+ it 'parses fatal error: on the beginning of the line for cached PCH' do
296
+ @formatter.should receive(:format_error).with(
297
+ "fatal error: file '/path/to/myproject/Pods/Pods-environment.h' has been modified since the precompiled header '/Users/hiroshi/Library/Developer/Xcode/DerivedData/MyProject-gfmuvpipjscewkdnqacgumhfarrd/Build/Intermediates/PrecompiledHeaders/MyProject-Prefix-dwjpvcnrlaydzmegejmcvrtcfkpf/MyProject-Prefix.pch.pch' was built"
298
+ )
299
+ @parser.parse(SAMPLE_FATAL_COMPILE_PCH_ERROR)
300
+ end
301
+
302
+
303
+
304
+ it "parses compiling errors with tildes" do
305
+ @formatter.should receive(:format_compile_error).with(
306
+ 'NSSetTests.m',
307
+ '/Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSSetTests.m:93:16',
308
+ "no visible @interface for 'NSArray' declares the selector 'shoulds'",
309
+ ' }] shoulds] equal:@[ @"F458 Italia", @"Testarossa" ]];',
310
+ ' ~~ ^~~~~~~')
311
+ SAMPLE_COMPILE_ERROR_WITH_TILDES.each_line do |line|
312
+ @parser.parse(line)
313
+ end
314
+ end
315
+
316
+ it "parses code sign error:" do
317
+ @formatter.should receive(:format_error).with(
318
+ 'Code Sign error: No code signing identites found: No valid signing identities (i.e. certificate and private key pair) matching the team ID “CAT6HF57NJ” were found.'
319
+ )
320
+ @parser.parse(SAMPLE_CODESIGN_ERROR)
321
+ end
322
+
323
+ it "parses CodeSign error: (no spaces)" do
324
+ @formatter.should receive(:format_error).with(
325
+ "CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 7.0'"
326
+ )
327
+ @parser.parse(SAMPLE_CODESIGN_ERROR_NO_SPACES)
328
+ end
329
+
330
+ it "parses ld library errors" do
331
+ @formatter.should receive(:format_error).with(
332
+ SAMPLE_LD_LIBRARY_ERROR
333
+ )
334
+ @parser.parse(SAMPLE_LD_LIBRARY_ERROR)
335
+ end
336
+
337
+ it 'parses ld symbols errors' do
338
+ @formatter.should receive(:format_error).with(
339
+ SAMPLE_LD_SYMBOLS_ERROR
340
+ )
341
+ @parser.parse(SAMPLE_LD_SYMBOLS_ERROR)
342
+ end
343
+
344
+ it "doesn't print the same error over and over" do
345
+ SAMPLE_COMPILE_ERROR.each_line do |line|
346
+ @parser.parse(line)
347
+ end
348
+ @formatter.should_not receive(:format_compile_error)
349
+ @parser.parse("hohohoooo")
350
+ end
351
+
352
+ end
353
+
354
+
355
+ context "summary" do
356
+
357
+ def given_tests_have_started(reporter = SAMPLE_OCUNIT_TEST_RUN_BEGINNING)
358
+ @parser.parse(reporter)
359
+ end
360
+
361
+ def given_tests_are_done(reporter = SAMPLE_OCUNIT_TEST_RUN_COMPLETION)
362
+ @parser.parse(reporter)
363
+ end
364
+
365
+ def given_kiwi_tests_are_done
366
+ @parser.parse(SAMPLE_KIWI_TEST_RUN_COMPLETION)
367
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
368
+ @parser.parse(SAMPLE_KIWI_SUITE_COMPLETION)
369
+ end
370
+
371
+ it "returns empty string if the suite is not done" do
372
+ @parser.parse(SAMPLE_EXECUTED_TESTS).should == ""
373
+ end
374
+
375
+ it "knows when the test suite is done for OCunit" do
376
+ given_tests_are_done
377
+ @formatter.should receive(:format_test_summary)
378
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
379
+ end
380
+
381
+ it "knows when the test suite is done for Specta" do
382
+ given_tests_are_done
383
+ @formatter.should receive(:format_test_summary)
384
+ @parser.parse(SAMPLE_SPECTA_EXECUTED_TESTS)
385
+ end
386
+
387
+ it "doesn't print executed message twice for Kiwi tests" do
388
+ @formatter.should_receive(:format_test_summary).once
389
+ given_tests_have_started(SAMPLE_KIWI_TEST_RUN_BEGINNING)
390
+ given_kiwi_tests_are_done
391
+ end
392
+
393
+ it "knows when the test suite is done for XCtest" do
394
+ @formatter.should_receive(:format_test_summary).once
395
+ 2.times {
396
+ given_tests_are_done(SAMPLE_KIWI_TEST_RUN_COMPLETION)
397
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
398
+ }
399
+ end
400
+
401
+ it "prints OCunit / XCTest summary twice if tests executed twice" do
402
+ @formatter.should_receive(:format_test_summary).twice
403
+ 2.times {
404
+ given_tests_have_started
405
+ given_tests_are_done
406
+ @parser.parse(SAMPLE_EXECUTED_TESTS)
407
+ }
408
+ end
409
+
410
+ it "prints Kiwi summary twice if tests executed twice" do
411
+ @formatter.should_receive(:format_test_summary).twice
412
+ 2.times {
413
+ given_tests_have_started(SAMPLE_KIWI_TEST_RUN_BEGINNING)
414
+ given_kiwi_tests_are_done
415
+ }
416
+ end
417
+
418
+ end
419
+
420
+ end
421
+ end