Alex Lam S.L
24967b8be8
fix & improve coverage of estree ( #1935 )
...
- fix `estree` conversion of getter/setter
- fix non-directive literal in `to_mozilla_ast()`
- revamp `test/mozilla-ast.js`
- reuse `test/ufuzz.js` for code generation
- use `acorn.parse()` for creating `estree`
- extend `test/ufuzz.js` for `acorn` workaround
- catch variable redefinition
- non-trivial literal as directive
- adjust options for tolerance
Miscellaneous
- optional semi-colon when parsing directives
fixes #1914
closes #1915
2017-05-15 18:33:43 +08:00
Alex Lam S.L
c934fc8142
implement test/sandbox.js ( #1749 )
...
- `test/run-tests.js` and `test/ufuzz.js` now shares the same `run_code()` and `same_stdout()`
- re-enable fuzzer to generate top-level `NaN`, `Infinity` & `undefined`
- attempt to show beautified output only when `run_code()` output is preserved
2017-04-01 05:47:11 +08:00
Alex Lam S.L
ec7f37f314
remove UGLIFY_DEBUG ( #1720 )
...
fixes #1719
2017-03-29 01:27:24 +08:00
Alex Lam S.L
701035621d
fix expect_stdout ( #1642 )
...
`compress()` may modify input ASTs
add tests for #1627 & #1640
2017-03-24 13:19:50 +08:00
Alex Lam S.L
c0f3feae9f
introduce compressor.info() ( #1633 )
...
report the following only when `options.warnings = "verbose"`
- unused elements due to inlining
- collpased variables
2017-03-23 06:49:49 +08:00
Alex Lam S.L
a3cc3a9b87
make expect_stdout work on Node.js 0.12 ( #1623 )
...
That particular version of Node.js has messed up error messages, so provide a version-specific workaround.
Also fixed an formatting issue which would cause `expect_stdout` to fail if error message contains excerpts of input.
Apply `expect_stdout` to more applicable tests.
2017-03-19 12:00:32 +08:00
Alex Lam S.L
0489d6de64
handle runtime errors in expect_stdout ( #1618 )
...
allow test to pass if both `input` and `expect` throws the same kind of error
2017-03-18 02:33:51 +08:00
Alex Lam S.L
fb092839c2
fix top-level directives in compress tests ( #1615 )
...
`input` and `expect` are parsed as `AST_BlockStatement` which does not support `AST_Directive` by default.
Emulate that by transforming preceding `AST_SimpleStatement`s of `AST_String` into `AST_Directive`.
2017-03-18 01:56:15 +08:00
Alex Lam S.L
3563d8c09e
extend test/run-tests.js to optionally execute uglified output ( #1604 )
...
fixes #1588
2017-03-16 23:20:06 +08:00
Alex Lam S.L
be80f7e706
support multi-line string in tests ( #1590 )
...
`expect_exact` sometimes have multiple lines and `\n` are hard to read.
Use array of strings to emulate line breaks and improve readability.
2017-03-10 11:27:30 +08:00
alexlamsl
c525a2b190
fix duplicated test names
...
previously test cases with the same name would be skipped except for the last one
`test/run-test.js` will now report duplicated names as errors
closes #1461
2017-02-21 13:29:58 +08:00
kzc
ec2e5fa3a2
Have minify() and tests use figure_out_scope() as uglifyjs CLI does
...
Clarify docs, help and tests for --support-ie8 and screw_ie8=false
2017-01-19 17:14:33 +01:00
Anthony Van de Gejuchte
057de570e6
Pass mangle options to figure_out_scope before mangling in tests
2016-10-27 22:55:49 +02:00
kzc
67cca43358
Test reparsing test/compress/*.js output
2016-08-14 21:27:23 +02:00
Shrey Banga
e645ba84cf
Respect quote style in object literals
...
The option added in fbbaa42ee5 wasn't
being respected inside object literals, so quoted property names would
still be stripped out with this option.
This is mostly a corner-case, but useful when the output is passed to
something like the Closure compiler, where quoted property names can be
used to prevent mangling.
2016-06-19 21:13:31 +02:00
Anthony Van de Gejuchte
2149bfb707
Don't mix strings with directives in output
...
* Don't interpret strings with escaped content as directive
* Don't interpret strings after empty statement as directive
* Adapt output to prevent strings being represent as directive
* Introduce UGLIFY_DEBUG to allow internal testing like EXPECT_DIRECTIVE
2016-06-19 20:59:17 +02:00
Anthony Van de Gejuchte
31d5825a86
Catch errors when compression test fails to parse
2016-06-09 21:12:15 +02:00
Anthony Van de Gejuchte
6641dcafb6
Fix regression causing tests to fail on windows
2016-05-04 20:05:51 +02:00
kzc
c55dd5ed74
Add passes compress option. Fix duplicate compress warnings.
2016-04-19 20:05:33 +02:00
Richard van Velzen
187a0caf9d
Add base54.reset() to compress tests
...
Without this reset, char counts bleed to next tests. One test had a bad expect clause.
2016-04-12 20:08:09 +02:00
kzc
3907a5e3b2
Fix warnings for referenced non-hoisted functions.
...
Fixes #1034
Also added `expect_warnings` functionality to test framework.
2016-04-11 18:15:20 +02:00
Anthony Van de Gejuchte
6605d15783
Never mangle arguments and keep them in their scope
...
Fixes #892
Helped-by: kzc
2016-01-14 19:45:52 +01:00
Anthony Van de Gejuchte
8c6af09ae0
Add mocha tests
2015-12-27 22:38:20 +01:00
Mihai Bazon
619adb0308
Replace util.error with console.log
2015-11-12 11:47:37 +02:00
Richard van Velzen
335e349314
Allow specification beautify options in tests
...
Caught an error in #847 as well - `output` wasn't passed anywhere which led to an exception. `options` was available though.
2015-10-28 20:50:01 +01:00
Fábio Santos
b5623b19d4
Fix #836
2015-10-20 19:48:56 +01:00
Mihai Bazon
1940fb682c
Fix tests
2015-10-12 10:27:00 +03:00
Richard van Velzen
759b3f7d6d
Fix mangling of property names which overwrite unmangleable properties
...
Fixes #747 .
2015-08-05 21:18:39 +02:00
Richard van Velzen
f8684f418a
Replace util.puts in run-tests with console.log
...
See d2dda34b2a
2015-07-29 15:24:45 +02:00
Fábio Santos
de58b0289d
Added expect_exact for testing the OutputStream
...
This works almost exactly like `expect`, except that you pass a literal string
of which the result is compared with the generated output.
2015-04-14 20:26:47 +02:00
Ingvar Stepanyan
b467a3c877
Added generative testing for AST conversions.
2014-08-03 20:48:59 +03:00
Mihai Bazon
582cc55cff
Display number of failed tests and corresponding files
2013-10-27 10:02:44 +02:00
Richard van Velzen
118105db43
Add an exit code to the test suite
...
By adding the exit code 1 (or any other non-zero exit code) `npm test`
will know the tests didn't perform correctly. This way it's easier to
know if pull requests are good or bad.
2013-10-23 20:24:58 +02:00
Mihai Bazon
afb7faa6fa
more optimizations for some break/continue cases
2012-10-18 15:14:57 +03:00
Mihai Bazon
1ffd526554
disable warnings in the test suite
2012-10-13 15:18:11 +03:00
Mihai Bazon
fcc0229087
drop unused function arguments
...
also add test for "drop_unused" (the last one fails for now)
2012-10-13 15:04:44 +03:00
Mihai Bazon
3412498795
AST cleanup (dropped AST_StatementBase)
2012-10-03 15:41:11 +03:00
Mihai Bazon
13278c6649
removed the "squeeze" method (it's now effectively "transform")
2012-09-26 19:52:32 +03:00
Mihai Bazon
4f97da9660
minor tests fix
2012-09-24 10:27:49 +03:00
Mihai Bazon
2b4093ba83
fixed run-tests and an issue about reversing the condition in AST_If
2012-09-12 13:00:13 +03:00
Mihai Bazon
43c75c9248
checkpoint
2012-09-07 18:55:13 +03:00
Mihai Bazon
919b2733ab
always keep declarations found in unreachable code
...
a few more tests and some cleanups.
2012-09-07 15:18:32 +03:00
Mihai Bazon
b77574ea1c
fixed tests (need to drop the toplevel block in "expected" if it's a single statement)
2012-09-07 11:22:01 +03:00
Mihai Bazon
d7c1dc6c05
a LabeledStatement should be in fact a StatementWithBody
...
This fixes output for:
if (foo) {
moo: if (bar) {
break moo;
}
} else {
baz();
}
(the labeled statement must be outputted inside brackets)
2012-09-03 12:05:10 +03:00
Mihai Bazon
8dfa9fe7e5
minor
2012-08-27 11:00:26 +03:00
Mihai Bazon
159a6f048c
wrote more of the compressor and added some tests
2012-08-22 15:21:58 +03:00