os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/package.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/package.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,71 @@
     1.4 +# This file contains tests for the ::package::* commands.
     1.5 +# Note that the tests are limited to Tcl scripts only, there are no shared
     1.6 +# libraries against which to test.
     1.7 +#
     1.8 +# Sourcing this file into Tcl runs the tests and generates output for
     1.9 +# errors.  No output means no errors were found.
    1.10 +#
    1.11 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.12 +# All rights reserved.
    1.13 +#
    1.14 +# RCS: @(#) $Id: package.test,v 1.3 2000/04/10 17:19:02 ericm Exp $
    1.15 +
    1.16 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.17 +    package require tcltest
    1.18 +    namespace import -force ::tcltest::*
    1.19 +}
    1.20 +
    1.21 +test package-1.1 {pkg::create gives error on insufficient args} {
    1.22 +    catch {::pkg::create}
    1.23 +} 1
    1.24 +test package-1.2 {pkg::create gives error on bad args} {
    1.25 +    catch {::pkg::create -foo bar -bar baz -baz boo}
    1.26 +} 1
    1.27 +test package-1.3 {pkg::create gives error on no value given} {
    1.28 +    catch {::pkg::create -name foo -version 1.0 -source test.tcl -load}
    1.29 +} 1
    1.30 +test package-1.4 {pkg::create gives error on no name given} {
    1.31 +    catch {::pkg::create -version 1.0 -source test.tcl -load foo.so}
    1.32 +} 1
    1.33 +test package-1.5 {pkg::create gives error on no version given} {
    1.34 +    catch {::pkg::create -name foo -source test.tcl -load foo.so}
    1.35 +} 1
    1.36 +test package-1.6 {pkg::create gives error on no source or load options} {
    1.37 +    catch {::pkg::create -name foo -version 1.0 -version 2.0}
    1.38 +} 1
    1.39 +test package-1.7 {pkg::create gives correct output for 1 direct source} {
    1.40 +    ::pkg::create -name foo -version 1.0 -source test.tcl
    1.41 +} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]}
    1.42 +test package-1.8 {pkg::create gives correct output for 2 direct sources} {
    1.43 +    ::pkg::create -name foo -version 1.0 -source test.tcl -source test2.tcl
    1.44 +} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list source [file join $dir test2.tcl]]}
    1.45 +test package-1.9 {pkg::create gives correct output for 1 direct load} {
    1.46 +    ::pkg::create -name foo -version 1.0 -load test.so
    1.47 +} {package ifneeded foo 1.0 [list load [file join $dir test.so]]}
    1.48 +test package-1.10 {pkg::create gives correct output for 2 direct loads} {
    1.49 +    ::pkg::create -name foo -version 1.0 -load test.so -load test2.so
    1.50 +} {package ifneeded foo 1.0 [list load [file join $dir test.so]]\n[list load [file join $dir test2.so]]}
    1.51 +test package-1.11 {pkg::create gives correct output for 1 lazy source} {
    1.52 +    ::pkg::create -name foo -version 1.0 -source {test.tcl {foo bar}}
    1.53 +} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.tcl source {foo bar}}}]}
    1.54 +test package-1.12 {pkg::create gives correct output for 2 lazy sources} {
    1.55 +    ::pkg::create -name foo -version 1.0 -source {test.tcl {foo bar}} \
    1.56 +	    -source {test2.tcl {baz boo}}
    1.57 +} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.tcl source {foo bar}} {test2.tcl source {baz boo}}}]}
    1.58 +test package-1.13 {pkg::create gives correct output for 1 lazy load} {
    1.59 +    ::pkg::create -name foo -version 1.0 -load {test.so {foo bar}}
    1.60 +} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.so load {foo bar}}}]}
    1.61 +test package-1.14 {pkg::create gives correct output for 2 lazy loads} {
    1.62 +    ::pkg::create -name foo -version 1.0 -load {test.so {foo bar}} \
    1.63 +	    -load {test2.so {baz boo}}
    1.64 +} {package ifneeded foo 1.0 [list tclPkgSetup $dir foo 1.0 {{test.so load {foo bar}} {test2.so load {baz boo}}}]}
    1.65 +test package-1.15 {pkg::create gives correct output for 1 each, direct} {
    1.66 +    ::pkg::create -name foo -version 1.0 -source test.tcl -load test2.so
    1.67 +} {package ifneeded foo 1.0 [list load [file join $dir test2.so]]\n[list source [file join $dir test.tcl]]}
    1.68 +test package-1.16 {pkg::create gives correct output for 1 direct, 1 lazy} {
    1.69 +    ::pkg::create -name foo -version 1.0 -source test.tcl \
    1.70 +	    -source {test2.tcl {foo bar}}
    1.71 +} {package ifneeded foo 1.0 [list source [file join $dir test.tcl]]\n[list tclPkgSetup $dir foo 1.0 {{test2.tcl source {foo bar}}}]}
    1.72 +
    1.73 +::tcltest::cleanupTests
    1.74 +return