source: branches/1.6/lang/tcl/tests/copy.test @ 6221

Last change on this file since 6221 was 3177, checked in by mmc, 12 years ago

Updated all of the copyright notices to reference the transfer to
the new HUBzero Foundation, LLC.

File size: 2.7 KB
Line 
1# Commands covered: Rappture::library
2#
3# This file contains a collection of tests for one of the Rappture Tcl
4# commands.  Sourcing this file into Tcl runs the tests and
5# generates output for errors.  No output means no errors were found.
6#
7# ======================================================================
8# AUTHOR:  Derrick Kearney, Purdue University
9# Copyright (c) 2004-2012  HUBzero Foundation, LLC
10#
11# See the file "license.terms" for information on usage and redistribution
12# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
14
15if {[lsearch [namespace children] ::tcltest] == -1} {
16    package require tcltest
17    package require Rappture
18    namespace import -force ::tcltest::*
19}
20catch {unset lib}
21
22#----------------------------------------------------------
23# copy command
24# copy "<path> from ?<xmlobj>? <path>"
25#----------------------------------------------------------
26catch {unset lib}
27set lib [Rappture::library rplib_test.xml]
28test library-9.0.1.1 {copy command, 0 args} {
29    list [catch {$lib copy} msg] $msg
30} {1 {wrong # args: should be "libraryObj0 copy path from ?arg arg ...?"}}
31test library-9.0.2.1 {copy command, 0 args} {
32    list [catch {$lib copy "input.number(min)"} msg] $msg
33} {1 {wrong # args: should be "libraryObj0 copy path from ?arg arg ...?"}}
34test library-9.0.3.1 {copy command, 1 arg} {
35    list [catch {$lib copy "input.number(min)" from } msg] $msg
36} {1 {wrong # args: should be "copy path from ?xmlobj? path"}}
37test library-9.0.4 {copy command not enough arg} {
38    list [catch {$lib copy "input.number(min)" from $lib} msg] $msg
39} {1 {bad path component "::libraryObj0"}}
40test library-9.0.5.1 {copy command not enough arg} {
41    list [catch {$lib copy "input.number(min)" from } msg] $msg
42} {1 {wrong # args: should be "copy path from ?xmlobj? path"}}
43test library-9.1.1 {copy command, bad syntax, switched from -> junk} {
44    list [catch {$lib copy "input.number(blah)" junk "input.number(min)"} msg] $msg
45} {1 {bad syntax: should be "copy path from ?xmlobj? path"}}
46test library-9.2.1 {copy command valid command, no 2nd library} {
47    $lib copy "input.number(blah)" from "input.number(max)"
48    $lib get "input.number(blah).current"
49} {3}
50test library-9.2.2 {copy command valid command} {
51    set libnew [Rappture::library rplib_test.xml]
52    $libnew put "input.image(eye).current" "sdjfslkjflskjfslj"
53    $lib copy "input.image(blahblah)" from $libnew "input.image(eye)"
54    $lib get "input.image(blahblah).current"
55} {sdjfslkjflskjfslj}
56test library-9.2.3 {copy command valid command, fromObj's path does not exist} {
57    set libnew [Rappture::library rplib_test.xml]
58    $lib copy "input.image(blueblah)" from $libnew "input.image(eye)"
59    $lib get "input.image(blueblah).current"
60} {}
61
62::tcltest::cleanupTests
63return
Note: See TracBrowser for help on using the repository browser.