| 1 | |
|---|
| 2 | # mock the commands the ruby group uses |
|---|
| 3 | set prefix /opt/local |
|---|
| 4 | set os.platform mac |
|---|
| 5 | |
|---|
| 6 | proc name p0 { |
|---|
| 7 | global name.found |
|---|
| 8 | set name.found $p0 |
|---|
| 9 | } |
|---|
| 10 | proc version p0 { |
|---|
| 11 | global version.found |
|---|
| 12 | set version.found $p0 |
|---|
| 13 | } |
|---|
| 14 | proc categories p0 {} |
|---|
| 15 | proc distname p0 {} |
|---|
| 16 | proc dist_subdir p0 {} |
|---|
| 17 | proc depends_lib p0 { |
|---|
| 18 | global depends_lib.found |
|---|
| 19 | set depends_lib.found $p0 |
|---|
| 20 | } |
|---|
| 21 | proc post-extract p0 {} |
|---|
| 22 | proc configure.cmd {p0 p1 p2} {} |
|---|
| 23 | proc configure.pre_args p0 {} |
|---|
| 24 | proc build.target p0 { |
|---|
| 25 | global build.target.found |
|---|
| 26 | set build.target.found $p0 |
|---|
| 27 | } |
|---|
| 28 | proc build.cmd {p0 p1 p2} {} |
|---|
| 29 | proc pre-destroot p0 {} |
|---|
| 30 | proc destroot.cmd {p0 p1 p2} {} |
|---|
| 31 | proc destroot.target p0 {} |
|---|
| 32 | proc destroot.destdir {} {} |
|---|
| 33 | proc post-destroot p0 {} |
|---|
| 34 | |
|---|
| 35 | # evaluate ruby group file |
|---|
| 36 | set dir [file dirname ${argv0}] |
|---|
| 37 | source "${dir}/../ruby-1.0.tcl" |
|---|
| 38 | |
|---|
| 39 | namespace 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 | } |
|---|