@@ -15,7 +15,7 @@ class OsSpecificFrontendSpec extends AnyFlatSpec with Matchers {
15
15
generator : ProtocCodeGenerator ,
16
16
env : ExtraEnv ,
17
17
request : Array [Byte ]
18
- ): Array [Byte ] = {
18
+ ): (frontend. InternalState , Array [Byte ]) = {
19
19
val (path, state) = frontend.prepare(
20
20
generator,
21
21
env
@@ -45,10 +45,12 @@ class OsSpecificFrontendSpec extends AnyFlatSpec with Matchers {
45
45
)
46
46
process.exitValue()
47
47
frontend.cleanup(state)
48
- actualOutput.toByteArray
48
+ (state, actualOutput.toByteArray)
49
49
}
50
50
51
- protected def testSuccess (frontend : PluginFrontend ): Unit = {
51
+ protected def testSuccess (
52
+ frontend : PluginFrontend
53
+ ): frontend.InternalState = {
52
54
val random = new Random ()
53
55
val toSend = Array .fill(123 )(random.nextInt(256 ).toByte)
54
56
val toReceive = Array .fill(456 )(random.nextInt(256 ).toByte)
@@ -60,11 +62,15 @@ class OsSpecificFrontendSpec extends AnyFlatSpec with Matchers {
60
62
toReceive
61
63
}
62
64
}
63
- val response = testPluginFrontend(frontend, fakeGenerator, env, toSend)
65
+ val (state, response) =
66
+ testPluginFrontend(frontend, fakeGenerator, env, toSend)
64
67
response mustBe toReceive
68
+ state
65
69
}
66
70
67
- protected def testFailure (frontend : PluginFrontend ): Unit = {
71
+ protected def testFailure (
72
+ frontend : PluginFrontend
73
+ ): frontend.InternalState = {
68
74
val random = new Random ()
69
75
val toSend = Array .fill(123 )(random.nextInt(256 ).toByte)
70
76
val env = new ExtraEnv (secondaryOutputDir = " tmp" )
@@ -74,7 +80,9 @@ class OsSpecificFrontendSpec extends AnyFlatSpec with Matchers {
74
80
throw new OutOfMemoryError (" test error" )
75
81
}
76
82
}
77
- val response = testPluginFrontend(frontend, fakeGenerator, env, toSend)
83
+ val (state, response) =
84
+ testPluginFrontend(frontend, fakeGenerator, env, toSend)
78
85
response.length must be > 0
86
+ state
79
87
}
80
88
}
0 commit comments