rake for ruby ext

This commit is contained in:
Kyle Maxwell 2009-02-26 12:15:14 -08:00
parent d3892cd91d
commit b2baefcc14
5 changed files with 32 additions and 3 deletions

View File

@ -47,5 +47,7 @@ check-am:
@echo "optional..."; ./dexter test/optional.dex test/optional.html | diff test/optional.json - && echo " success."
@echo "malformed-function..."; ./dexter test/malformed-function.dex test/malformed-function.html | diff test/malformed-function.json - && echo " success."
@echo "empty..."; ./dexter test/empty.dex test/empty.html | diff test/empty.json - && echo " success."
@echo "hn..."; ./dexter test/hn.dex test/hn.html | diff test/hn.json - && echo " success."
@echo "trivial..."; ./dexter test/trivial.dex test/trivial.html | diff test/trivial.json - && echo " success."
@echo "trivial2..."; ./dexter test/trivial2.dex test/trivial2.html | diff test/trivial2.json - && echo " success."
@echo "craigs-simple..."; ./dexter test/craigs-simple.dex test/craigs-simple.html | diff test/craigs-simple.json - && echo " success."
@echo "hn..."; ./dexter test/hn.dex test/hn.html | diff test/hn.json - && echo " success."

View File

@ -750,6 +750,9 @@ check-am:
@echo "optional..."; ./dexter test/optional.dex test/optional.html | diff test/optional.json - && echo " success."
@echo "malformed-function..."; ./dexter test/malformed-function.dex test/malformed-function.html | diff test/malformed-function.json - && echo " success."
@echo "empty..."; ./dexter test/empty.dex test/empty.html | diff test/empty.json - && echo " success."
@echo "trivial..."; ./dexter test/trivial.dex test/trivial.html | diff test/trivial.json - && echo " success."
@echo "trivial2..."; ./dexter test/trivial2.dex test/trivial2.html | diff test/trivial2.json - && echo " success."
@echo "craigs-simple..."; ./dexter test/craigs-simple.dex test/craigs-simple.html | diff test/craigs-simple.json - && echo " success."
@echo "hn..."; ./dexter test/hn.dex test/hn.html | diff test/hn.json - && echo " success."
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -2,7 +2,7 @@
# libtool - Provide generalized library-building support services.
# Generated automatically by config.status (dexterc) 1.0
# Libtool was configured on host kyle-maxwells-macbook.local:
# Libtool was configured on host 111.flood.pivotallabs.com:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,

18
ruby/Rakefile Normal file
View File

@ -0,0 +1,18 @@
task :default => :test
task :test => :build do
Dir["test/*test*.rb"].each {|f| load f }
end
task :build => :clean do
"cd ext && ruby extconf.rb && make"
end
task :clean do
"cd ext && make clean"
end
task :install do
system "gem build dexterous.gemspec"
system "gem install dexterous"
end

View File

@ -6,6 +6,12 @@ class TestDexterous < Test::Unit::TestCase
@file = File.dirname(__FILE__) + "/../../test/yelp.html"
end
def test_yelp
@dex = Dexterous.new(File.read(File.dirname(__FILE__) + "/../../test/yelp-home.dex"))
out = @dex.parse(:file => File.dirname(__FILE__) + "/../../test/yelp-home.html")
assert_equal "/c/sf/shopping", out["categories"][0]["href"]
end
def test_simple
@dex = Dexterous.new("hi" => "h1")
assert_equal({"hi" => "Nick's Crispy Tacos"}, @dex.parse(:file => @file))