os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/package.test
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
# This file contains tests for the ::package::* commands.
sl@0
     2
# Note that the tests are limited to Tcl scripts only, there are no shared
sl@0
     3
# libraries against which to test.
sl@0
     4
#
sl@0
     5
# Sourcing this file into Tcl runs the tests and generates output for
sl@0
     6
# errors.  No output means no errors were found.
sl@0
     7
#
sl@0
     8
# Copyright (c) 1998-1999 by Scriptics Corporation.
sl@0
     9
# All rights reserved.
sl@0
    10
#
sl@0
    11
# RCS: @(#) $Id: package.test,v 1.3 2000/04/10 17:19:02 ericm Exp $
sl@0
    12
sl@0
    13
if {[lsearch [namespace children] ::tcltest] == -1} {
sl@0
    14
    package require tcltest
sl@0
    15
    namespace import -force ::tcltest::*
sl@0
    16
}
sl@0
    17
sl@0
    18
test package-1.1 {pkg::create gives error on insufficient args} {
sl@0
    19
    catch {::pkg::create}
sl@0
    20
} 1
sl@0
    21
test package-1.2 {pkg::create gives error on bad args} {
sl@0
    22
    catch {::pkg::create -foo bar -bar baz -baz boo}
sl@0
    23
} 1
sl@0
    24
test package-1.3 {pkg::create gives error on no value given} {
sl@0
    25
    catch {::pkg::create -name foo -version 1.0 -source test.tcl -load}
sl@0
    26
} 1
sl@0
    27
test package-1.4 {pkg::create gives error on no name given} {
sl@0
    28
    catch {::pkg::create -version 1.0 -source test.tcl -load foo.so}
sl@0
    29
} 1
sl@0
    30
test package-1.5 {pkg::create gives error on no version given} {
sl@0
    31
    catch {::pkg::create -name foo -source test.tcl -load foo.so}
sl@0
    32
} 1
sl@0
    33
test package-1.6 {pkg::create gives error on no source or load options} {
sl@0
    34
    catch {::pkg::create -name foo -version 1.0 -version 2.0}
sl@0
    35
} 1
sl@0
    36
test package-1.7 {pkg::create gives correct output for 1 direct source} {
sl@0
    37
    ::pkg::create -name foo -version 1.0 -source test.tcl
sl@0
    38
} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]}
sl@0
    39
test package-1.8 {pkg::create gives correct output for 2 direct sources} {
sl@0
    40
    ::pkg::create -name foo -version 1.0 -source test.tcl -source test2.tcl
sl@0
    41
} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]}
sl@0
    42
test package-1.9 {pkg::create gives correct output for 1 direct load} {
sl@0
    43
    ::pkg::create -name foo -version 1.0 -load test.so
sl@0
    44
} {package ifneeded foo 1.0 [list load [file join $dir test.so]]}
sl@0
    45
test package-1.10 {pkg::create gives correct output for 2 direct loads} {
sl@0
    46
    ::pkg::create -name foo -version 1.0 -load test.so -load test2.so
sl@0
    47
} {package ifneeded foo 1.0 [list load [file join $dir test.so]]\n[list load [file join $dir test2.so]]}
sl@0
    48
test package-1.11 {pkg::create gives correct output for 1 lazy source} {
sl@0
    49
    ::pkg::create -name foo -version 1.0 -source {test.tcl {foo bar}}
sl@0
    50
} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.tcl source {foo bar}}}]}
sl@0
    51
test package-1.12 {pkg::create gives correct output for 2 lazy sources} {
sl@0
    52
    ::pkg::create -name foo -version 1.0 -source {test.tcl {foo bar}} \
sl@0
    53
	    -source {test2.tcl {baz boo}}
sl@0
    54
} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.tcl source {foo bar}} {test2.tcl source {baz boo}}}]}
sl@0
    55
test package-1.13 {pkg::create gives correct output for 1 lazy load} {
sl@0
    56
    ::pkg::create -name foo -version 1.0 -load {test.so {foo bar}}
sl@0
    57
} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.so load {foo bar}}}]}
sl@0
    58
test package-1.14 {pkg::create gives correct output for 2 lazy loads} {
sl@0
    59
    ::pkg::create -name foo -version 1.0 -load {test.so {foo bar}} \
sl@0
    60
	    -load {test2.so {baz boo}}
sl@0
    61
} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.so load {foo bar}} {test2.so load {baz boo}}}]}
sl@0
    62
test package-1.15 {pkg::create gives correct output for 1 each, direct} {
sl@0
    63
    ::pkg::create -name foo -version 1.0 -source test.tcl -load test2.so
sl@0
    64
} {package ifneeded foo 1.0 [list load [file join $dir test2.so]]\n[list source [file join $dir test.tcl]]}
sl@0
    65
test package-1.16 {pkg::create gives correct output for 1 direct, 1 lazy} {
sl@0
    66
    ::pkg::create -name foo -version 1.0 -source test.tcl \
sl@0
    67
	    -source {test2.tcl {foo bar}}
sl@0
    68
} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list tclPkgSetup $dir foo 1.0 {{test2.tcl source {foo bar}}}]}
sl@0
    69
sl@0
    70
::tcltest::cleanupTests
sl@0
    71
return