Ticket #15912: ruby-1.0.tcl

File ruby-1.0.tcl, 3.5 KB (added by febeling@…, 16 years ago)

test cases, put into subdir group/tests to run

Line 
1
2# mock the commands the ruby group uses
3set prefix                    /opt/local
4set os.platform               mac
5
6proc name p0                  {
7        global name.found
8        set name.found $p0
9}
10proc version p0               {
11        global version.found
12        set version.found $p0
13}
14proc categories p0            {}
15proc distname p0              {}
16proc dist_subdir p0           {}
17proc depends_lib p0           {
18        global depends_lib.found
19        set depends_lib.found $p0
20}
21proc post-extract p0          {}
22proc configure.cmd {p0 p1 p2} {}
23proc configure.pre_args p0    {}
24proc build.target p0          {
25        global build.target.found
26        set build.target.found $p0
27}
28proc build.cmd {p0 p1 p2}     {}
29proc pre-destroot p0          {}
30proc destroot.cmd {p0 p1 p2}  {}
31proc destroot.target p0       {}
32proc destroot.destdir {}      {}
33proc post-destroot p0         {}
34
35# evaluate ruby group file
36set dir [file dirname ${argv0}]
37source "${dir}/../ruby-1.0.tcl"
38
39namespace eval tests {
40        # Backwards compatible behaviour, assumes ruby 1.8
41        proc test_rubysetup_compatible {} {
42                global ruby.version
43                global ruby.module
44                global ruby.project
45                global ruby.filename
46                global ruby.bin
47                global ruby.docs
48                global build.target.found
49                global name.found
50                global version.found
51                global depends_lib.found
52
53                ruby.setup {test_module tmod} 9.9 setup.rb {README INSTALL}
54
55                if {![string equal "1.8" ${ruby.version}]} { error "ruby.version failed'" }
56                if {![string equal "test_module" ${ruby.module}]} { error "ruby.module failed" }
57                if {![string equal "tmod" ${ruby.project}]} { error "ruby.project failed" }
58                if {![string equal "tmod" ${ruby.filename}]} { error "ruby.filename failed" }
59                if {![string equal {README INSTALL} ${ruby.docs}]} { error "ruby.docs failed"}
60                if {![string equal "setup" ${build.target.found}]} { error "type-derived field build.target failed: ${build.target.found}"}
61                if {![string equal "rb-test_module" ${name.found}]} { error "drived name failed: ${name.found}" }
62                if {![string equal "9.9" ${version.found}]} { error "port version set failed" }
63                if {![string equal port:ruby ${depends_lib.found}]} { error "depends_lib failed: ${depends_lib.found}" }
64        }
65
66        proc test_rubysetup_ruby19 {} {
67                global ruby.version
68                global ruby.module
69                global ruby.project
70                global ruby.filename
71                global ruby.bin
72                global ruby.docs
73
74                global build.target.found
75                global name.found
76                global version.found
77                global depends_lib.found
78
79                ruby.setup {test_module tmod} 9.9 setup.rb {README INSTALL} custom ruby19
80
81                # changed prefix
82                if {![string equal "1.9.0" ${ruby.version}]} { error "ruby.version failed: '${ruby.version}'" }
83                if {![string equal "rb19-test_module" ${name.found}]} { error "drived name failed: ${name.found}" }
84
85                if {![string equal "test_module" ${ruby.module}]} { error "ruby.module failed" }
86                if {![string equal "tmod" ${ruby.project}]} { error "ruby.project failed" }
87                if {![string equal "tmod" ${ruby.filename}]} { error "ruby.filename failed" }
88                if {![string equal {README INSTALL} ${ruby.docs}]} { error "ruby.docs failed"}
89                if {![string equal "setup" ${build.target.found}]} { error "type-derived field failed: ${build.target.found}"}
90                if {![string equal "9.9" ${version.found}]} { error "port version set failed" }
91                if {![string equal "port:ruby19" ${depends_lib.found}]} { error "depends_lib failed: ${depends_lib.found}" }
92        }
93
94        proc test_setup_implementation_specifics {} {
95                if {![catch {ruby.setup_implementation_specifics unknown_impl}]} {
96                        error "wrong implementation name should raise error"
97                }
98        }
99       
100        # run all tests
101        foreach proc [info procs test_*] { 
102                $proc
103        }
104}