@@ -16,16 +16,16 @@ class SipScalaTests extends ScalaCliSuite {
16
16
newCliPath
17
17
}
18
18
}
19
- def powerArgs (isRestricted : Boolean ) = if (isRestricted) Nil else Seq (" --power" )
19
+ def powerArgs (isPowerMode : Boolean ): Seq [ String ] = if (isPowerMode) Seq (" --power" ) else Nil
20
20
21
- def testDirectoriesCommand (isRestricted : Boolean ): Unit =
21
+ def testDirectoriesCommand (isPowerMode : Boolean ): Unit =
22
22
TestInputs .empty.fromRoot { root =>
23
- val res = os.proc(TestUtil .cli, powerArgs(isRestricted ), " directories" ).call(
23
+ val res = os.proc(TestUtil .cli, powerArgs(isPowerMode ), " directories" ).call(
24
24
cwd = root,
25
25
check = false ,
26
26
mergeErrIntoOut = true
27
27
)
28
- if (isRestricted ) {
28
+ if (! isPowerMode ) {
29
29
expect(res.exitCode == 1 )
30
30
val output = res.out.text()
31
31
expect(output.contains(
@@ -35,7 +35,7 @@ class SipScalaTests extends ScalaCliSuite {
35
35
else expect(res.exitCode == 0 )
36
36
}
37
37
38
- def testPublishDirectives (isRestricted : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
38
+ def testPublishDirectives (isPowerMode : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
39
39
val code =
40
40
"""
41
41
| //> using publish.name "my-library"
@@ -45,13 +45,13 @@ class SipScalaTests extends ScalaCliSuite {
45
45
val source = root / " A.scala"
46
46
os.write(source, code)
47
47
48
- val res = os.proc(TestUtil .cli, powerArgs(isRestricted ), " compile" , source).call(
48
+ val res = os.proc(TestUtil .cli, powerArgs(isPowerMode ), " compile" , source).call(
49
49
cwd = root,
50
50
check = false ,
51
51
mergeErrIntoOut = true
52
52
)
53
53
54
- if (isRestricted ) {
54
+ if (! isPowerMode ) {
55
55
expect(res.exitCode == 1 )
56
56
val output = res.out.text()
57
57
expect(output.contains(s " directive is experimental " ))
@@ -60,7 +60,7 @@ class SipScalaTests extends ScalaCliSuite {
60
60
expect(res.exitCode == 0 )
61
61
}
62
62
63
- def testMarkdownOptions (isRestricted : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
63
+ def testMarkdownOptions (isPowerMode : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
64
64
val code =
65
65
"""
66
66
| println("ala")
@@ -70,12 +70,12 @@ class SipScalaTests extends ScalaCliSuite {
70
70
os.write(source, code)
71
71
72
72
val res =
73
- os.proc(TestUtil .cli, powerArgs(isRestricted ), " --scala" , " 3" , " --markdown" , source).call(
73
+ os.proc(TestUtil .cli, powerArgs(isPowerMode ), " --scala" , " 3" , " --markdown" , source).call(
74
74
cwd = root,
75
75
check = false ,
76
76
mergeErrIntoOut = true
77
77
)
78
- if (isRestricted ) {
78
+ if (! isPowerMode ) {
79
79
expect(res.exitCode == 1 )
80
80
val output = res.out.text()
81
81
expect(output.contains(s " option is experimental " ))
@@ -97,42 +97,45 @@ class SipScalaTests extends ScalaCliSuite {
97
97
}
98
98
}
99
99
100
- def testDefaultHelpOutput (isRestricted : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
100
+ def testDefaultHelpOutput (isPowerMode : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
101
101
for (helpOptions <- HelpTests .variants) {
102
102
val output =
103
- os.proc(TestUtil .cli, powerArgs(isRestricted ), helpOptions).call(cwd = root).out.trim()
103
+ os.proc(TestUtil .cli, powerArgs(isPowerMode ), helpOptions).call(cwd = root).out.trim()
104
104
val restrictedFeaturesMentioned = output.contains(" package" )
105
- if (isRestricted ) expect(! restrictedFeaturesMentioned)
105
+ if (! isPowerMode ) expect(! restrictedFeaturesMentioned)
106
106
else expect(restrictedFeaturesMentioned)
107
107
}
108
108
}
109
109
110
- def testReplHelpOutput (isRestricted : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
110
+ def testReplHelpOutput (isPowerMode : Boolean ): Unit = TestInputs .empty.fromRoot { root =>
111
111
val output =
112
- os.proc(TestUtil .cli, powerArgs(isRestricted ), " repl" , " --help-full" ).call(cwd =
112
+ os.proc(TestUtil .cli, powerArgs(isPowerMode ), " repl" , " --help-full" ).call(cwd =
113
113
root
114
114
).out.trim()
115
115
val restrictedFeaturesMentioned = output.contains(" --amm" )
116
116
val experimentalFeaturesMentioned = output.contains(" --python" )
117
- if (isRestricted ) expect(! restrictedFeaturesMentioned && ! experimentalFeaturesMentioned)
117
+ if (! isPowerMode ) expect(! restrictedFeaturesMentioned && ! experimentalFeaturesMentioned)
118
118
else expect(restrictedFeaturesMentioned && experimentalFeaturesMentioned)
119
119
}
120
120
121
- for (isRestricted <- Seq (false , true )) {
122
- test(s " test directories command when restricted mode is enabled: $isRestricted" ) {
123
- testDirectoriesCommand(isRestricted)
121
+ for {
122
+ isPowerMode <- Seq (false , true )
123
+ powerModeString = if (isPowerMode) " enabled" else " disabled"
124
+ } {
125
+ test(s " test directories command when power mode is $powerModeString" ) {
126
+ testDirectoriesCommand(isPowerMode)
124
127
}
125
- test(s " test publish directives when restricted mode is enabled: $isRestricted " ) {
126
- testPublishDirectives(isRestricted )
128
+ test(s " test publish directives when power mode is $powerModeString " ) {
129
+ testPublishDirectives(isPowerMode )
127
130
}
128
- test(s " test markdown options when restricted mode is enabled: $isRestricted " ) {
129
- testMarkdownOptions(isRestricted )
131
+ test(s " test markdown options when power mode is $powerModeString " ) {
132
+ testMarkdownOptions(isPowerMode )
130
133
}
131
- test(s " test default help when restricted mode is enabled: $isRestricted " ) {
132
- testDefaultHelpOutput(isRestricted )
134
+ test(s " test default help when power mode is $powerModeString " ) {
135
+ testDefaultHelpOutput(isPowerMode )
133
136
}
134
- test(s " test repl help when restricted mode is enabled: $isRestricted " ) {
135
- testReplHelpOutput(isRestricted )
137
+ test(s " test repl help when power mode is $powerModeString " ) {
138
+ testReplHelpOutput(isPowerMode )
136
139
}
137
140
}
138
141
0 commit comments