[107833] branches/gsoc13-tests/tests/test

marius at macports.org marius at macports.org
Sat Jul 6 10:45:00 PDT 2013


Revision: 107833
          https://trac.macports.org/changeset/107833
Author:   marius at macports.org
Date:     2013-07-06 10:45:00 -0700 (Sat, 06 Jul 2013)
Log Message:
-----------
Fixed checksum-1 and site-tags to use initial_setup and one general proc for checksums.

Modified Paths:
--------------
    branches/gsoc13-tests/tests/test/checksums-1/test.tcl
    branches/gsoc13-tests/tests/test/site-tags/test.tcl

Modified: branches/gsoc13-tests/tests/test/checksums-1/test.tcl
===================================================================
--- branches/gsoc13-tests/tests/test/checksums-1/test.tcl	2013-07-06 17:30:42 UTC (rev 107832)
+++ branches/gsoc13-tests/tests/test/checksums-1/test.tcl	2013-07-06 17:45:00 UTC (rev 107833)
@@ -7,65 +7,39 @@
 makeDirectory $work_dir
 set path [file dirname [file normalize $argv0]]
 
-# Initial setup
-load_variables $path
-set_dir
-port_index
-port_clean $path
-port_run $path
+initial_setup
 
-
-# Useful procs
-proc get_md5 {filename} {
+proc get_checksum {type} {
     global path
-    set md5 "debug: calculated (md5)*"
+    global output_file
 
-    set line [get_line $path/$filename $md5]
+    append string "debug: calculated (" $type ")*"
+    set line [get_line $path/$output_file $string]
     set result [lrange [split $line " "] 4 4]
 
     return $result
 }
 
-proc get_sha {filename} {
-    global path
-    set sha "debug: calculated (sha1)*"
 
-    set line [get_line $path/$filename $sha]
-    set result [lrange [split $line " "] 4 4]
-
-    return $result
-}
-
-proc get_rmd {filename} {
-    global path
-    set sha "debug: calculated (rmd160)*"
-
-    set line [get_line $path/$filename $sha]
-    set result [lrange [split $line " "] 4 4]
-
-    return $result
-}
-
-
 # Test cases
 test md5_checksum {
     Regression test for MD5 Checksum.
 } -body {
-    get_md5 $output_file
+    get_checksum md5
 } -result "d41d8cd98f00b204e9800998ecf8427e"
 
 
 test sha1_checksum {
     Regression test for SHA1 Checksum.
 } -body {
-    get_sha $output_file
+    get_checksum sha1
 } -result "da39a3ee5e6b4b0d3255bfef95601890afd80709"
 
 
 test rmd160_checksum {
     Regression test for RMD160 Checksum.
 } -body {
-    get_rmd $output_file
+    get_checksum rmd160
 } -result "9c1185a5c5e9fc54612808977ee8f548b2258d31"
 
 

Modified: branches/gsoc13-tests/tests/test/site-tags/test.tcl
===================================================================
--- branches/gsoc13-tests/tests/test/site-tags/test.tcl	2013-07-06 17:30:42 UTC (rev 107832)
+++ branches/gsoc13-tests/tests/test/site-tags/test.tcl	2013-07-06 17:45:00 UTC (rev 107833)
@@ -11,11 +11,7 @@
     global output_file
     global path
 
-    load_variables $path
-    set_dir
-    port_index
-    port_clean $path
-    port_run $path
+    initial_setup
 
     set err "error*"
     set line [get_line $output_file $err]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130706/dd2b3229/attachment.html>


More information about the macports-changes mailing list