test/test_edl.rb in edl-0.0.5 vs test/test_edl.rb in edl-0.0.6

- old
+ new

@@ -280,10 +280,21 @@ @spliced.length.should.equal 1 @spliced[0].src_start_tc.should.equal '06:42:50:18'.tc @spliced[0].src_end_tc.should.equal '06:42:52:16'.tc end + + specify "not apply any Matchers if a match is found" do + p = EDL::Parser.new + m1 = flexmock + m1.should_receive(:matches?).with("plop").once.and_return(true) + m1.should_receive(:apply).once + + flexmock(p).should_receive(:get_matchers).once.and_return([m1, m1]) + + p.parse("plop") + end end context "A TimewarpMatcher should" do specify "not create any extra events when used within a Parser" do @@ -483,10 +494,42 @@ mok_evt.comments.should.equal ["COMMENT: PURE BULLSHIT", "COMMENT: PURE BULLSHIT"] end end +context "FallbackMatcher should" do + specify "match anything" do + line = "SOME" + EDL::FallbackMatcher.new.matches?(line).should.equal true + + line = "OR ANOTHER " + EDL::FallbackMatcher.new.matches?(line).should.equal true + end + + specify "not match whitespace" do + line = "\s\s\s\r\n\r" + EDL::FallbackMatcher.new.matches?(line).should.equal false + end + + specify "append the matched content to comments" do + e = flexmock + cmts = [] + e.should_receive(:comments).and_return(cmts) + + EDL::FallbackMatcher.new.apply([e], "FOOBAR") + cmts.should.equal ["FOOBAR"] + + EDL::FallbackMatcher.new.apply([e], "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I") + cmts.should.equal ["FOOBAR", "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I"] + end + + specify "raise an ApplyError if no clip is on the stack" do + lambda { EDL::FallbackMatcher.new.apply([], "FINAL CUT PRO REEL: 006-I REPLACED BY: 006I") }.should.raise(EDL::Matcher::ApplyError) + end + +end + context "ClipNameMatcher should" do specify "match a clip name" do line = "* FROM CLIP NAME: TAPE_6-10.MOV" EDL::NameMatcher.new.matches?(line).should.equal true end @@ -575,9 +618,17 @@ assert_equal 1000, first_evt.src_length assert_equal "01:00:00:00", first_evt.capture_from_tc.to_s assert_equal "01:00:40:00", first_evt.capture_to_tc.to_s + end +end + +context "In the trailer EDL the event 4 should" do + specify "not have too many comments" do + evts = EDL::Parser.new.parse(File.open(TRAILER_EDL)) + evt = evts[6] + evt.comments.length.should.equal(5) end end context "A FinalCutPro speedup and reverse with fade at the end should" do specify "parse cleanly" do \ No newline at end of file