[138950] trunk/base/src/macports1.0/tests/macports.test
Revision: 138950 https://trac.macports.org/changeset/138950 Author: raimue@macports.org Date: 2015-07-24 15:16:30 -0700 (Fri, 24 Jul 2015) Log Message: ----------- macports1.0: rewrite/fix test for ui_message Modified Paths: -------------- trunk/base/src/macports1.0/tests/macports.test Modified: trunk/base/src/macports1.0/tests/macports.test =================================================================== --- trunk/base/src/macports1.0/tests/macports.test 2015-07-24 21:53:57 UTC (rev 138949) +++ trunk/base/src/macports1.0/tests/macports.test 2015-07-24 22:16:30 UTC (rev 138950) @@ -246,33 +246,46 @@ test ui_message { UI message unit test. } -setup { - set fd [open $pwd/message w+] - set fd2 [open $pwd/log w+] + set fd [open $pwd/message w] + set fd2 [open $pwd/log w] set macports::channels(0) $fd - set macports::channels(debuglog) $fd2 set macports::current_phase test set ::debuglog $fd2 } -body { set res [ui_message 0 prefix args] close $fd close $fd2 - set fd2 [open $pwd/message r] - set line [read $fd2] + + set fd [open $pwd/message r] + set fd2 [open $pwd/log r] + set line [read $fd] if {$line ne "prefixargs\n"} { - return "FAIL: wrong message: $line" + return "FAIL: wrong message: $line" } + set line [read $fd2] + if {$line ne ":0:test args\n"} { + return "FAIL: wrong log: $line" + } + close $fd close $fd2 - set fd [open $pwd/message w+] - set fd2 [open $pwd/log w+] - set res [ui_message debuglog prefix -nonewline arg] + set fd [open $pwd/message w] + set fd2 [open $pwd/log w] + set res [ui_message 0 prefix -nonewline arg] close $fd close $fd2 + + set fd [open $pwd/message r] set fd2 [open $pwd/log r] - set line [read $fd2] + set line [read $fd] if {$line ne "prefixarg"} { - return "FAIL: wrong message: $line" + return "FAIL: wrong message: $line" } + set line [read $fd2] + if {$line ne ":0:test arg"} { + return "FAIL: wrong log: $line" + } + close $fd close $fd2 return "UI message successful."
participants (1)
-
raimue@macports.org