source: trunk/lang/tcl/tests/get.test @ 6112

Last change on this file since 6112 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.9 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}
21set lib [Rappture::library rplib_test.xml]
22
23#----------------------------------------------------------
24#----------------------------------------------------------
25# get command
26# get ?<path>?
27#----------------------------------------------------------
28test get-1.0.1 {get command, zero arguments } {
29    set val [$lib get]
30} {}
31test get-1.0.2 {get command, two arguments } {
32    list [ catch {$lib get "input.number(min).default" "ggg"} msg] $msg
33} {1 {wrong # args: should be "get ?-decode yes? ?path?"}}
34#----------------------------------------------------------
35test get-1.1 {get command valid path} {
36    set cmd [$lib get "tool.command"]
37} {@tool/graph @driver}
38#----------------------------------------------------------
39test get-1.1.2 {get command valid path, single level path doesnt exist} {
40    set cmd [$lib get "dsffds"]
41} {}
42test get-1.1.3 {get command valid path, multiple levels, path doesnt exist} {
43    set cmd [$lib get "dsffds.sdfsdf"]
44} {}
45test get-1.1.3 {get command valid path, multiple levels, with id, path doesnt exist} {
46    set cmd [$lib get "dsffds.sdfsdf(1234)"]
47} {}
48#----------------------------------------------------------
49test get-1.2.1 {get command valid full path number} {
50    set cmd [$lib get "input.number(min).default"]
51} {0}
52test get-1.2.2 {get command valid partial path number} {
53    set cmd [$lib get "input.(min).default"]
54} {0}
55test get-1.2.3 {get command valid partial path number} {
56    set cmd [$lib get "input.(min).current"]
57} {1}
58test get-3.2.5 {get command valid partial path number} {
59    set cmd [$lib get "input.number.default"]
60    # this should grab the first occurance of number -> number(min)
61} {0}
62test get-3.2.6 {get command valid partial path number} {
63    set cmd [$lib get "input.number.noexist"]
64} {}
65test get-3.2.7 {get command valid partial path number} {
66    set cmd [$lib get "input.(min).noexist"]
67} {}
68test get-3.2.8 {get command invalid path number} {
69    set cmd [$lib get "input..number"]
70} {}
71test get-3.2.9 {get command invalid path number} {
72    set cmd [$lib get "input.().number"]
73} {}
74test get-3.2.10 {get command invalid path number} {
75    set cmd [$lib get "input.(!!).number"]
76} {}
77
78::tcltest::cleanupTests
79return
Note: See TracBrowser for help on using the repository browser.