wrote more of the compressor and added some tests
This commit is contained in:
49
test/compress/blocks.js
Normal file
49
test/compress/blocks.js
Normal file
@@ -0,0 +1,49 @@
|
||||
remove_blocks: {
|
||||
input: {
|
||||
{;}
|
||||
foo();
|
||||
{};
|
||||
{
|
||||
{};
|
||||
};
|
||||
bar();
|
||||
{}
|
||||
}
|
||||
expect: {
|
||||
foo();
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
keep_some_blocks: {
|
||||
input: {
|
||||
// 1.
|
||||
if (foo) {
|
||||
{{{}}}
|
||||
if (bar) baz();
|
||||
{{}}
|
||||
} else {
|
||||
stuff();
|
||||
}
|
||||
|
||||
// 2.
|
||||
if (foo) {
|
||||
for (var i = 0; i < 5; ++i)
|
||||
if (bar) baz();
|
||||
} else {
|
||||
stuff();
|
||||
}
|
||||
}
|
||||
expect: {
|
||||
// 1.
|
||||
if (foo) {
|
||||
if (bar) baz();
|
||||
} else stuff();
|
||||
|
||||
// 2.
|
||||
if (foo) {
|
||||
for (var i = 0; i < 5; ++i)
|
||||
if (bar) baz();
|
||||
} else stuff();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user