[112325] trunk/base/src/macports1.0/tests/macports_dlist.test
marius at macports.org
marius at macports.org
Fri Oct 18 06:59:37 PDT 2013
Revision: 112325
https://trac.macports.org/changeset/112325
Author: marius at macports.org
Date: 2013-10-18 06:59:36 -0700 (Fri, 18 Oct 2013)
Log Message:
-----------
macports_dlist.test: added ditem tests
Modified Paths:
--------------
trunk/base/src/macports1.0/tests/macports_dlist.test
Modified: trunk/base/src/macports1.0/tests/macports_dlist.test
===================================================================
--- trunk/base/src/macports1.0/tests/macports_dlist.test 2013-10-18 11:34:58 UTC (rev 112324)
+++ trunk/base/src/macports1.0/tests/macports_dlist.test 2013-10-18 13:59:36 UTC (rev 112325)
@@ -112,27 +112,10 @@
} -result "count unmet successful."
+# These just call the procs in macports_dlist namespace
# test ditem_create
# test ditem_delete
-
-
-test ditem_key {
- Ditem key unit test.
-} -setup {
- set mport [mportopen file://.]
-} -body {
- if {[ditem_key $mport {provides}] != "fondu"} {
- return "FAIL: wrong key value"
- }
- if {[ditem_key $mport {wants}] != ""} {
- return "FAIL: wrong key detected"
- }
- return "ditem key successful."
-} -cleanup {
- mportclose $mport
-} -result "ditem key successful."
-
-
+# test ditem_key
# test ditem_append
# test ditem_append_unique
# test ditem_contains
@@ -190,13 +173,79 @@
} -result "dlist eval successful."
-# test ditem_create
-# test ditem_delete
-# test ditem_key
-# test ditem_append
-# test ditem_append_unique
+test ditem_create {
+ Ditem create unit test.
+} -body {
+ set res [macports_dlist::ditem_create]
+ if {[string match "ditem_*" $res] == 0} {
+ return "FAIL: ditem not created"
+ }
+ if {[info exists macports_dlist::$res] != 1} {
+ return "FAIL: array not set"
+ }
+ return "Create ditem successful."
+} -result "Create ditem successful."
+test ditem_delete {
+ Ditem delete unit test.
+} -body {
+ set res [macports_dlist::ditem_create]
+ set res [macports_dlist::ditem_delete $res]
+ if {[info exists macports_dlist::$res] != 0} {
+ return "FAIL: array not deleted"
+ }
+ return "Ditem delete successful."
+} -result "Ditem delete successful."
+
+
+test ditem_key {
+ Ditem key unit test.
+} -setup {
+ set res [macports_dlist::ditem_create]
+ macports_dlist::ditem_key $res macports test
+} -body {
+ if {[array get macports_dlist::$res macports] != "macports test"} {
+ return "FAIL ditem key not set"
+ }
+ return "Ditem key successful."
+} -cleanup {
+ macports_dlist::ditem_delete $res
+} -result "Ditem key successful."
+
+
+test ditem_append {
+ Ditem append unit test.
+} -setup {
+ set res [macports_dlist::ditem_create]
+ macports_dlist::ditem_key $res macports test
+ macports_dlist::ditem_append $res macports test2
+} -body {
+ if {[array get macports_dlist::$res macports] != "macports {test test2}"} {
+ return "FAIL: ditem key not appended"
+ }
+ return "Ditem key append successful."
+} -cleanup {
+ macports_dlist::ditem_delete $res
+} -result "Ditem key append successful."
+
+
+test ditem_append_unique {
+ Ditem append unique unit test.
+} -setup {
+ set res [macports_dlist::ditem_create]
+ macports_dlist::ditem_key $res macports test
+ macports_dlist::ditem_append_unique $res macports test
+} -body {
+ if {[array get macports_dlist::$res macports] != "macports test"} {
+ return "FAIL: ditem key not unique"
+ }
+ return "Ditem append unique successful."
+} -cleanup {
+ macports_dlist::ditem_delete $res
+} -result "Ditem append unique successful."
+
+
test ditem_contains {
Ditem contains unit test.
} -setup {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131018/7d686586/attachment.html>
More information about the macports-changes
mailing list