File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
test/com/google/javascript/jscomp Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -4404,16 +4404,22 @@ public void testIteratePreOrderWithPredicate() {
4404
4404
}
4405
4405
4406
4406
@ Test
4407
- public void addFeatureToScriptUpdatesCompilerFeatureSet () {
4407
+ public void prohibitAddingNonAllowableFeatureToScriptExceptModules () {
4408
4408
Node scriptNode = parse ("" );
4409
4409
Compiler compiler = new Compiler ();
4410
4410
compiler .setAllowableFeatures (FeatureSet .BARE_MINIMUM );
4411
4411
NodeUtil .addFeatureToScript (scriptNode , Feature .MODULES , compiler );
4412
4412
4413
+ // Adding MODULES to the script featureSet is okay, any other feature isn't
4413
4414
assertThat (NodeUtil .getFeatureSetOfScript (scriptNode ))
4414
4415
.isEqualTo (FeatureSet .BARE_MINIMUM .with (Feature .MODULES ));
4415
4416
assertFS (compiler .getAllowableFeatures ())
4416
4417
.equals (FeatureSet .BARE_MINIMUM .with (Feature .MODULES ));
4418
+
4419
+ compiler .setAllowableFeatures (FeatureSet .BARE_MINIMUM ); // reset
4420
+ assertThrows (
4421
+ IllegalStateException .class ,
4422
+ () -> NodeUtil .addFeatureToScript (scriptNode , Feature .LET_DECLARATIONS , compiler ));
4417
4423
}
4418
4424
4419
4425
@ Test
You can’t perform that action at this time.
0 commit comments