messing with ports

This commit is contained in:
Kyle Maxwell 2009-01-02 22:20:55 -08:00
parent 6e1f381206
commit f34de1b3d7
6 changed files with 36 additions and 50 deletions

6
.gitignore vendored
View File

@ -23,4 +23,8 @@ Makefile.in
libdexter.la
parser.h
test.log
ruby/dexter*.gem
ruby/dexter*.gem
ruby/ext/cdexter.bundle
ruby/ext/Makefile
ruby/ext/conftest.dSYM/
work

View File

@ -14,4 +14,15 @@ dexter_SOURCES = dexter_main.c
dexter_LDADD = libdexter.la
check-am:
ruby test-all.rb
@echo "fictional..."; ./dexter test/fictional.dex test/fictional.html | diff test/fictional.json - && echo " success."
@echo "function-magic..."; ./dexter test/function-magic.dex test/function-magic.html | diff test/function-magic.json - && echo " success."
@echo "malformed-expr..."; ./dexter test/malformed-expr.dex test/malformed-expr.html | diff test/malformed-expr.json - && echo " success."
@echo "malformed-json..."; ./dexter test/malformed-json.dex test/malformed-json.html | diff test/malformed-json.json - && echo " success."
@echo "match..."; ./dexter -x test/match.dex test/match.xml | diff test/match.json - && echo " success."
@echo "position..."; ./dexter test/position.dex test/position.html | diff test/position.json - && echo " success."
@echo "remote..."; ./dexter test/remote.dex test/remote.html | diff test/remote.json - && echo " success."
@echo "replace..."; ./dexter -x test/replace.dex test/replace.xml | diff test/replace.json - && echo " success."
@echo "scope..."; ./dexter test/scope.dex test/scope.html | diff test/scope.json - && echo " success."
@echo "test..."; ./dexter -x test/test.dex test/test.xml | diff test/test.json - && echo " success."
@echo "yelp..."; ./dexter test/yelp.dex test/yelp.html | diff test/yelp.json - && echo " success."

17
Portfile Normal file
View File

@ -0,0 +1,17 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id$
PortSystem 1.0
name dexter
version 0.1.0
categories net
maintainers kyle@kylemaxwell.com
description Data extractor
long_description Dexter is a system to extract data from HTML/XML documents
homepage http://github.com/fizx/dexter
platforms darwin
master_sites http://github.com/fizx/dexter/tarball/master
depends_lib port:argp-standalone \
port:json-c \
port:libxslt \
port:pcre

View File

@ -1,46 +0,0 @@
#!/usr/bin/env ruby
require "fileutils"
log = File.dirname(__FILE__) + "/test.log"
code = 0
dexter = File.dirname(__FILE__) + "/dexter"
FileUtils.rm_f(log)
Dir[File.dirname(__FILE__) + "/test/*.dex"].each do |f|
print "testing #{f} ..."
STDOUT.flush
begin
html = f.sub(/dex$/, "html")
xml = f.sub(/dex$/, "xml")
flag = File.exists?(xml) ? "-x" : ""
input = File.exists?(xml) ? xml : html
expected = File.read(f.sub(/dex$/, "json")).strip
output = `#{dexter} #{flag} #{f} #{input}`.strip
if expected == output
puts "success"
else
puts "failed, see test.log"
code += 1
File.open(log, "a") do |lf|
lf.puts "Failure: #{f}"
lf.puts "=" * 78
lf.puts "expected: #{expected}"
lf.puts "got: #{output}"
lf.puts
end
end
rescue Exception => e
code += 1
puts "exception, see test.log"
File.open(log, "a") do |lf|
lf.puts e.message
lf.puts e.backtrace.join("\n")
lf.puts
end
end
end
exit code

View File

@ -1 +1 @@
{ "magics": [ { "head": "head1", "para": [ " a", " b" ], "single": " a" }, { "head": "head2", "para": [ " Z" ], "single": " Z" } ] }
{ "magics": [ { "head": "head1", "para": [ " a", " b" ], "single": " a" }, { "head": "head2", "para": [ " Z" ], "single": " Z" } ] }

View File

@ -1 +1 @@
{ "title": "Google" }
{ "title": "Google" }