NaN and Infinity were replaced in the output generation, instead of during compression. This could lead to results where `1/0` was inserted without parens leading to invalid output. The nodes are replaced in the compression step now, and the output generation returns their regular names. This should not be a problem, since they're already only constructed from the original name.
26 lines
488 B
JavaScript
26 lines
488 B
JavaScript
NaN_and_Infinity_must_have_parens: {
|
|
options = {};
|
|
input: {
|
|
Infinity.toString();
|
|
NaN.toString();
|
|
}
|
|
expect: {
|
|
(1/0).toString();
|
|
(0/0).toString();
|
|
}
|
|
}
|
|
|
|
NaN_and_Infinity_should_not_be_replaced_when_they_are_redefined: {
|
|
options = {};
|
|
input: {
|
|
var Infinity, NaN;
|
|
Infinity.toString();
|
|
NaN.toString();
|
|
}
|
|
expect: {
|
|
var Infinity, NaN;
|
|
Infinity.toString();
|
|
NaN.toString();
|
|
}
|
|
}
|