spec/xcpretty/parser_spec.rb in xcpretty-0.1.7 vs spec/xcpretty/parser_spec.rb in xcpretty-0.1.8

- old
+ new

@@ -56,13 +56,18 @@ it "parses code signing a framework" do @formatter.should receive(:format_codesign).with("build/Release/CocoaChipCore.framework") @parser.parse(SAMPLE_CODESIGN_FRAMEWORK) end + it 'parses compiler_space_in_path' do + @formatter.should receive(:format_compile).with('SASellableItem.m', "SACore/App/Models/Core\\ Data/human/SASellableItem.m") + @parser.parse(SAMPLE_COMPILE_SPACE_IN_PATH) + end + it "parses compiler commands" do - compile_statement = SAMPLE_ANOTHER_COMPILE.lines().to_a.last() - @formatter.should receive(:format_compile_command).with(compile_statement.strip()) + compile_statement = SAMPLE_ANOTHER_COMPILE.lines.to_a.last + @formatter.should receive(:format_compile_command).with(compile_statement.strip, "/Users/musalj/code/OSS/Kiwi/Classes/Core/KWNull.m") @parser.parse(compile_statement) end it "parses compiling categories" do @formatter.should receive(:format_compile).with("NSMutableArray+ObjectiveSugar.m", "/Users/musalj/code/OSS/ObjectiveSugar/Classes/NSMutableArray+ObjectiveSugar.m") @@ -78,26 +83,38 @@ @formatter.should receive(:format_compile).with("KWNull.mm", "Classes/Core/KWNull.mm") @parser.parse(SAMPLE_ANOTHER_COMPILE.sub('.m', '.mm')) end it "parses compiling C and C++ files" do - for file_extension in ['.c', '.cc', '.cpp', '.cxx'] do + ['.c', '.cc', '.cpp', '.cxx'].each do |file_extension| @formatter.should receive(:format_compile).with("KWNull" + file_extension, "Classes/Core/KWNull" + file_extension) @parser.parse(SAMPLE_ANOTHER_COMPILE.sub('.m', file_extension)) end end it "parses compiling XIBs" do @formatter.should receive(:format_compile_xib).with("MainMenu.xib", "CocoaChip/en.lproj/MainMenu.xib") @parser.parse(SAMPLE_COMPILE_XIB) end + it 'parses CopyPlistFile' do + @formatter.should receive(:format_copy_plist_file).with( + '/path/to/Some.plist', '/some other/File.plist') + @parser.parse('CopyPlistFile /path/to/Some.plist /some other/File.plist') + end + it "parses CopyStringsFile" do @formatter.should receive(:format_copy_strings_file).with('InfoPlist.strings') @parser.parse(SAMPLE_COPYSTRINGS) end + it "parses CpHeader" do + @formatter.should receive(:format_copy_header_file).with( + '/path/to/Header.h','/some other/path/Header.h') + @parser.parse('CpHeader /path/to/Header.h /some other/path/Header.h') + end + it "parses CpResource" do @formatter.should receive(:format_cpresource).with('ObjectiveSugar/Default-568h@2x.png') @parser.parse(SAMPLE_CPRESOURCE) end @@ -155,37 +172,75 @@ @formatter.should receive(:format_pending_test).with('TAPIConversationSpec', 'TAPIConversation_createConversation_SendsAPOSTRequestToTheConversationsEndpoint') @parser.parse(SAMPLE_PENDING_KIWI_TEST) end + it 'parses measuring tests' do + @formatter.should receive(:format_measuring_test).with( + 'SecEncodeTransformTests.SecEncodeTransformTests', + 'test_RFC4648_Decode_UsingBase32', + '0.013' + ) + @parser.parse(SAMPLE_MEASURING_TEST) + end + it "parses PhaseScriptExecution" do @formatter.should receive(:format_phase_script_execution).with('Check Pods Manifest.lock') @parser.parse(SAMPLE_RUN_SCRIPT) end it "parses process PCH" do @formatter.should receive(:format_process_pch).with("Pods-CocoaLumberjack-prefix.pch") @parser.parse(SAMPLE_PRECOMPILE) end + it 'parses process PCH command' do + compile_statement = SAMPLE_PRECOMPILE.lines.to_a.last + @formatter.should receive(:format_process_pch_command).with("/Users/musalj/code/OSS/ObjectiveRecord/Pods/Pods-CocoaLumberjack-prefix.pch") + @parser.parse(compile_statement) + end + it "parses preprocessing" do @formatter.should receive(:format_preprocess).with("CocoaChip/CocoaChip-Info.plist") @parser.parse(SAMPLE_PREPROCESS) end it "parses PBXCp" do @formatter.should receive(:format_pbxcp).with("build/Release/CocoaChipCore.framework") @parser.parse(SAMPLE_PBXCP) end + it 'parses changing directories' do + @formatter.should receive(:format_shell_command).with('cd', + '/some/place/out\ there') + @parser.parse(' cd /some/place/out\ there') + end + + it 'parses any indented command' do + @formatter.should receive(:format_shell_command).with( + '/bin/rm', '-rf /bin /usr /Users') + @parser.parse(' /bin/rm -rf /bin /usr /Users') + end + it "parses Touch" do @formatter.should receive(:format_touch).with( '/Users/musalj/Library/Developer/Xcode/DerivedData/Alcatraz-aobuxcinaqyzjugrnxjjhfzgwaou/Build/Products/Debug/AlcatrazTests.octest', 'AlcatrazTests.octest') @parser.parse(SAMPLE_TOUCH) end + it "parses write file" do + @formatter.should receive(:format_write_file).with( + '/Users/me/myproject/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-AFNetworking.build/Objects-normal/x86_64/Pods-AFNetworking.LinkFileList') + @parser.parse(SAMPLE_WRITE_FILE) + end + + it "parses write auxiliary files" do + @formatter.should receive(:format_write_auxiliary_files) + @parser.parse(SAMPLE_WRITE_AUXILIARY_FILES) + end + it "parses TiffUtil" do @formatter.should receive(:format_tiffutil).with('eye_icon.tiff') @parser.parse(SAMPLE_TIFFUTIL) end @@ -250,11 +305,10 @@ @formatter.should receive(:format_test_suite_started).with('All tests') @parser.parse(SAMPLE_SPECTA_SUITE_BEGINNING) end context "errors" do - it "parses clang errors" do @formatter.should receive(:format_error).with(SAMPLE_CLANG_ERROR) @parser.parse(SAMPLE_CLANG_ERROR) end @@ -354,16 +408,32 @@ @parser.parse(line) end @formatter.should_not receive(:format_compile_error) @parser.parse("hohohoooo") end - end + context "warnings" do + it 'parses compiler warnings' do + @formatter.should receive(:format_warning).with("TEST 123") + @parser.parse("warning: TEST 123") + end - context "summary" do + it "parses compiling warnings" do + @formatter.should receive(:format_compile_warning).with( + "AppDelegate.m", + "/Users/supermarin/code/oss/ObjectiveSugar/Example/ObjectiveSugar/AppDelegate.m:19:31", + "format specifies type 'id' but the argument has type 'int' [-Wformat]", + " NSLog(@\"I HAZ %@ CATS\", 1);", + " ~~ ^") + SAMPLE_FORMAT_WARNING.each_line do |line| + @parser.parse(line) + end + end + end + context "summary" do def given_tests_have_started(reporter = SAMPLE_OCUNIT_TEST_RUN_BEGINNING) @parser.parse(reporter) end def given_tests_are_done(reporter = SAMPLE_OCUNIT_TEST_RUN_COMPLETION) @@ -420,10 +490,9 @@ 2.times { given_tests_have_started(SAMPLE_KIWI_TEST_RUN_BEGINNING) given_kiwi_tests_are_done } end - end end end