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 | |
---|
15 | if {[lsearch [namespace children] ::tcltest] == -1} { |
---|
16 | package require tcltest |
---|
17 | package require Rappture |
---|
18 | namespace import -force ::tcltest::* |
---|
19 | } |
---|
20 | catch {unset lib} |
---|
21 | set lib [Rappture::library rplib_test.xml] |
---|
22 | |
---|
23 | #---------------------------------------------------------- |
---|
24 | #---------------------------------------------------------- |
---|
25 | # get command |
---|
26 | # get ?<path>? |
---|
27 | #---------------------------------------------------------- |
---|
28 | test get-1.0.1 {get command, zero arguments } { |
---|
29 | set val [$lib get] |
---|
30 | } {} |
---|
31 | test 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 | #---------------------------------------------------------- |
---|
35 | test get-1.1 {get command valid path} { |
---|
36 | set cmd [$lib get "tool.command"] |
---|
37 | } {@tool/graph @driver} |
---|
38 | #---------------------------------------------------------- |
---|
39 | test get-1.1.2 {get command valid path, single level path doesnt exist} { |
---|
40 | set cmd [$lib get "dsffds"] |
---|
41 | } {} |
---|
42 | test get-1.1.3 {get command valid path, multiple levels, path doesnt exist} { |
---|
43 | set cmd [$lib get "dsffds.sdfsdf"] |
---|
44 | } {} |
---|
45 | test 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 | #---------------------------------------------------------- |
---|
49 | test get-1.2.1 {get command valid full path number} { |
---|
50 | set cmd [$lib get "input.number(min).default"] |
---|
51 | } {0} |
---|
52 | test get-1.2.2 {get command valid partial path number} { |
---|
53 | set cmd [$lib get "input.(min).default"] |
---|
54 | } {0} |
---|
55 | test get-1.2.3 {get command valid partial path number} { |
---|
56 | set cmd [$lib get "input.(min).current"] |
---|
57 | } {1} |
---|
58 | test 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} |
---|
62 | test get-3.2.6 {get command valid partial path number} { |
---|
63 | set cmd [$lib get "input.number.noexist"] |
---|
64 | } {} |
---|
65 | test get-3.2.7 {get command valid partial path number} { |
---|
66 | set cmd [$lib get "input.(min).noexist"] |
---|
67 | } {} |
---|
68 | test get-3.2.8 {get command invalid path number} { |
---|
69 | set cmd [$lib get "input..number"] |
---|
70 | } {} |
---|
71 | test get-3.2.9 {get command invalid path number} { |
---|
72 | set cmd [$lib get "input.().number"] |
---|
73 | } {} |
---|
74 | test get-3.2.10 {get command invalid path number} { |
---|
75 | set cmd [$lib get "input.(!!).number"] |
---|
76 | } {} |
---|
77 | |
---|
78 | ::tcltest::cleanupTests |
---|
79 | return |
---|