source: ruby/trunk/lib/adl_parser/test/remote_adl_test.rb@ 319

Last change on this file since 319 was 319, checked in by Tatsukawa, Akimichi, 15 years ago

polishing ADL parser to handle http://www.openehr.org/svn/knowledge/archetypes/dev/adl/test/

File size: 1.6 KB
Line 
1require File.dirname(__FILE__) + '/test_helper.rb'
2
3class RemoteADLTest < Test::Unit::TestCase
4 def setup
5 @ehr_adls = []
6 ehr_dirs = ["cluster", "composition", "element", "entry", "section", "structure"]
7 ehr_dirs.each do |dir|
8 doc = Hpricot( open("http://www.openehr.org/svn/knowledge/archetypes/dev/adl/openehr/ehr/#{dir}").read )
9 (doc/:a).each do |link|
10 if link[:href] =~ /.*\.adl\Z/
11 @ehr_adls << "http://www.openehr.org/svn/knowledge/archetypes/dev/adl/openehr/ehr/#{dir}/#{$~}"
12 end
13 end
14 end
15
16 @test_adls = []
17 test_dirs = ["basics","clinical_types","dadl","description","generic_types","language","non-conforming","paths","rm_checking","slots","specialisation","structure","terminology","unicode","validation"]
18 test_dirs.each do |dir|
19 doc = Hpricot( open("http://www.openehr.org/svn/knowledge/archetypes/dev/adl/test/#{dir}").read )
20 (doc/:a).each do |link|
21 if link[:href] =~ /.*\.adl\Z/
22 @test_adls << "http://www.openehr.org/svn/knowledge/archetypes/dev/adl/test/#{dir}/#{$~}"
23 end
24 end
25 end
26 @parser = ::OpenEhr::ADL::Parser.new
27 end
28
29
30 must "test_adls should properly parsed" do
31 assert_nothing_raised do
32 @test_adls.each do |adl|
33 puts "Processing #{adl}"
34 open(adl) do |file|
35 @parser.parse(file.read, adl)
36 end
37 end
38 end
39 end
40
41# must "ehr_adls should properly parsed" do
42# assert_nothing_raised do
43# @ehr_adls.each do |adl|
44# puts "Processing #{adl}"
45# open(adl) do |file|
46# @parser.parse(file.read, adl)
47# end
48# end
49# end
50# end
51
52
53end
Note: See TracBrowser for help on using the repository browser.