@@ -65,10 +65,18 @@ private object Commands {
65
65
return func(" cargo test" , allFeature, enableAllFeatures)
66
66
}
67
67
68
+ fun cargoTest (featuresToEnable : Array <String >): String {
69
+ return func(" cargo test" , featuresToEnable.joinToString(" " ), true )
70
+ }
71
+
68
72
fun cargoCheck (enableAllFeatures : Boolean ): String {
69
73
return func(" cargo check" , allFeature, enableAllFeatures)
70
74
}
71
75
76
+ fun cargoCheck (featuresToEnable : Array <String >): String {
77
+ return func(" cargo test" , featuresToEnable.joinToString(" " ), true )
78
+ }
79
+
72
80
const val CargoFmt = " cargo fmt"
73
81
const val CargoClippy = " cargo clippy"
74
82
}
@@ -348,6 +356,8 @@ fun TestWriterDelegator.compileAndTest(
348
356
runClippy : Boolean = false,
349
357
expectFailure : Boolean = false,
350
358
enableUnstableFlag : Boolean = true,
359
+ enableAllFeatures : Boolean = false,
360
+ featuresToEnable : Array <String >? = null,
351
361
): String {
352
362
val stubModel = """
353
363
namespace fake
@@ -370,7 +380,13 @@ fun TestWriterDelegator.compileAndTest(
370
380
}
371
381
372
382
val env = Commands .cargoEnvAllowDeadCode(enableUnstableFlag)
373
- val testOutput = Commands .cargoTest(enableUnstableFlag).runCommand(baseDir, env)
383
+
384
+ var testCommand = Commands .cargoTest(enableUnstableFlag)
385
+ if (featuresToEnable != null ) {
386
+ testCommand = Commands .cargoCheck(featuresToEnable)
387
+ }
388
+
389
+ val testOutput = testCommand.runCommand(baseDir, env)
374
390
if (runClippy) {
375
391
Commands .CargoClippy .runCommand(baseDir, env)
376
392
}
0 commit comments