Changeset 133

Show
Ignore:
Timestamp:
04/04/2007 00:23:16 (20 months ago)
Author:
why
Message:
  • test/: added the youtube test from whatever ticket, can't remember.
  • Rakefile: ohh good ragel version check from #66.
Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/Rakefile

    r129 r133  
    108108end 
    109109 
     110desc "returns the ragel version" 
     111task :ragel_version do 
     112  @ragel_v = `ragel -v`[/(version )(\S*)/,2].to_f 
     113end 
     114 
    110115desc "Generates the C scanner code with Ragel." 
    111 task :ragel do 
    112   sh %{ragel ext/hpricot_scan/hpricot_scan.rl | rlcodegen -G2 -o ext/hpricot_scan/hpricot_scan.c} 
     116task :ragel => [:ragel_version] do 
     117  sh %{ragel ext/hpricot_scan/hpricot_scan.rl | #{@ragel_v >= 5.18 ? 'rlgen-cd' : 'rlcodegen'} -G2 -o ext/hpricot_scan/hpricot_scan.c} 
    113118end 
    114119 
    115120desc "Generates the Java scanner code with Ragel." 
    116 task :ragel_java do 
    117   sh %{ragel -J ext/hpricot_scan/hpricot_scan.java.rl | rlcodegen -o  ext/hpricot_scan/HpricotScanService.java} 
     121task :ragel_java => [:ragel_version] do 
     122  sh %{ragel -J ext/hpricot_scan/hpricot_scan.java.rl | #{@ragel_v >= 5.18 ? 'rlgen-java' : 'rlcodegen'} -o  ext/hpricot_scan/HpricotScanService.java} 
    118123end 
    119124 
  • trunk/test/test_parser.rb

    r127 r133  
    295295  end 
    296296 
     297  def test_youtube_attr 
     298    str = <<-edoc 
     299    <html><body> 
     300    Lorem ipsum. Jolly roger, ding-dong sing-a-long  
     301    <object width="425" height="350"> 
     302      <param name="movie" value="http://www.youtube.com/v/NbDQ4M_cuwA"></param> 
     303      <param name="wmode" value="transparent"></param> 
     304        <embed src="http://www.youtube.com/v/NbDQ4M_cuwA"  
     305          type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"> 
     306        </embed> 
     307    </object> 
     308    Check out my posting, I have bright mice in large clown cars. 
     309    <object width="425" height="350"> 
     310      <param name="movie" value="http://www.youtube.com/v/foobar"></param> 
     311      <param name="wmode" value="transparent"></param> 
     312        <embed src="http://www.youtube.com/v/foobar"  
     313          type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"> 
     314        </embed> 
     315    </object> 
     316    </body></html? 
     317    edoc 
     318    doc = Hpricot(str) 
     319    assert_equal "http://www.youtube.com/v/NbDQ4M_cuwA", 
     320      doc.at("//object/param[@value='http://www.youtube.com/v/NbDQ4M_cuwA']")['value'] 
     321  end 
     322   
    297323  def test_filters 
    298324    @basic = Hpricot.parse(TestFiles::BASIC)