This repository was archived by the owner on Sep 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +33
-13
lines changed
src/main/scala/scala/tools/partest/nest Expand file tree Collapse file tree 2 files changed +33
-13
lines changed Original file line number Diff line number Diff line change @@ -73,35 +73,28 @@ object NestUI {
73
73
f " $word $testNumber - $testIdent%-40s $reasonString"
74
74
}
75
75
76
- def reportTest (state : TestState ) = {
76
+ def reportTest (state : TestState , info : TestInfo ) = {
77
77
if (isTerse && state.isOk) {
78
78
if (dotCount >= DotWidth ) {
79
79
outline(" \n ." )
80
80
dotCount = 1
81
- }
82
- else {
81
+ } else {
83
82
outline(" ." )
84
83
dotCount += 1
85
84
}
86
- }
87
- else {
85
+ } else {
88
86
echo(statusLine(state))
89
87
if (! state.isOk) {
90
88
if (isDiffy) {
91
89
val differ = bold(red(" % " )) + " diff "
92
90
state.transcript find (_ startsWith differ) foreach (echo(_))
93
91
}
94
92
if (isLogging) {
95
- import scala .util .matching .Regex
96
93
def log (f : File ) = {
97
94
echo(bold(cyan(s " ##### Log file ' $f' from failed test ##### \n " )))
98
95
echo(f.fileContents)
99
96
}
100
- val prompt = bold(red(" % " ))
101
- val differ = raw " (?s) ${Regex .quote(prompt)}diff (\S*).* " .r
102
- state.transcript.collect {
103
- case differ(f) => f
104
- } foreach (log(_))
97
+ if (info.logFile.canRead) log(info.logFile)
105
98
}
106
99
}
107
100
}
Original file line number Diff line number Diff line change @@ -42,8 +42,35 @@ class TestTranscript {
42
42
}
43
43
}
44
44
45
+ trait TestInfo {
46
+ /** pos/t1234 */
47
+ def testIdent : String
48
+
49
+ /** pos */
50
+ def kind : String
51
+
52
+ // inputs
53
+
54
+ /** pos/t1234.scala or pos/t1234 if dir */
55
+ def testFile : File
56
+
57
+ /** pos/t1234.check */
58
+ def checkFile : File
59
+
60
+ /** pos/t1234.flags */
61
+ def flagsFile : File
62
+
63
+ // outputs
64
+
65
+ /** pos/t1234-pos.obj */
66
+ def outFile : File
67
+
68
+ /** pos/t1234-pos.log */
69
+ def logFile : File
70
+ }
71
+
45
72
/** Run a single test. Rubber meets road. */
46
- class Runner (val testFile : File , val suiteRunner : SuiteRunner ) {
73
+ class Runner (val testFile : File , val suiteRunner : SuiteRunner ) extends TestInfo {
47
74
48
75
import suiteRunner .{fileManager => fm , _ }
49
76
val fileManager = fm
@@ -802,7 +829,7 @@ class SuiteRunner(
802
829
catch {
803
830
case t : Throwable => throw new RuntimeException (s " Error running $testFile" , t)
804
831
}
805
- NestUI .reportTest(state)
832
+ NestUI .reportTest(state, runner )
806
833
runner.cleanup()
807
834
state
808
835
}
You can’t perform that action at this time.
0 commit comments