Skip to content

Commit 5a36064

Browse files
fix
1 parent 99113b5 commit 5a36064

File tree

1 file changed

+17
-1
lines changed
  • codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil

1 file changed

+17
-1
lines changed

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/testutil/Rust.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,18 @@ private object Commands {
6565
return func("cargo test", allFeature, enableAllFeatures)
6666
}
6767

68+
fun cargoTest(featuresToEnable: Array<String>): String {
69+
return func("cargo test", featuresToEnable.joinToString(" "), true)
70+
}
71+
6872
fun cargoCheck(enableAllFeatures: Boolean): String {
6973
return func("cargo check", allFeature, enableAllFeatures)
7074
}
7175

76+
fun cargoCheck(featuresToEnable: Array<String>): String {
77+
return func("cargo test", featuresToEnable.joinToString(" "), true)
78+
}
79+
7280
const val CargoFmt = "cargo fmt"
7381
const val CargoClippy = "cargo clippy"
7482
}
@@ -348,6 +356,8 @@ fun TestWriterDelegator.compileAndTest(
348356
runClippy: Boolean = false,
349357
expectFailure: Boolean = false,
350358
enableUnstableFlag: Boolean = true,
359+
enableAllFeatures: Boolean = false,
360+
featuresToEnable: Array<String>? = null,
351361
): String {
352362
val stubModel = """
353363
namespace fake
@@ -370,7 +380,13 @@ fun TestWriterDelegator.compileAndTest(
370380
}
371381

372382
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)
374390
if (runClippy) {
375391
Commands.CargoClippy.runCommand(baseDir, env)
376392
}

0 commit comments

Comments
 (0)