File: test_sniffer.rb

package info (click to toggle)
libfeedtools-ruby 0.2.29%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,004 kB
  • ctags: 1,385
  • sloc: ruby: 18,815; sql: 39; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require File.join(File.dirname(__FILE__), 'preamble')
require "html5/sniffer"

class TestFeedTypeSniffer < Test::Unit::TestCase
  include HTML5
  include TestSupport
  include Sniffer
  
  html5_test_files('sniffer').each do |test_file|
    test_name = File.basename(test_file).sub('.test', '')

    tests = JSON.parse(File.read(test_file))

    tests.each_with_index do |data, index|
      define_method('test_%s_%d' % [test_name, index + 1]) do
        assert_equal data['type'], html_or_feed(data['input'])
      end
    end
  end
  # each_with_index do |t, i|
  #     define_method "test_#{i}" do
  #       assert_equal t[0], sniff_feed_type(t[1])
  #     end
  #   end
  

end