make transformation tests compare output instead of ast

This commit is contained in:
Sebastian McKenzie
2014-11-03 17:52:15 +11:00
parent c963c30107
commit 171bcad870
172 changed files with 451 additions and 494 deletions

View File

@@ -60,7 +60,10 @@ CodeGenerator.prototype.newline = function (removeLast) {
};
CodeGenerator.prototype.removeLastNewline = function () {
if (this.isLast("\n")) this.buf = this.buf.slice(0, -1);
if (this.isLast("\n")) {
this.buf = this.buf.slice(0, -1);
this.line--;
}
};
CodeGenerator.prototype.semicolon = function () {
@@ -189,6 +192,8 @@ CodeGenerator.prototype.printSequence = function (print, nodes, opts) {
opts.print = function (node, i) {
var needs = function (fn) {
if (!self.opts.whitespace) return;
if (node.start != null) {
// user node
if (!fn(node)) return;
@@ -217,7 +222,7 @@ CodeGenerator.prototype.printSequence = function (print, nodes, opts) {
};
CodeGenerator.prototype.hasWhitespaceBetween = function (startToken, endToken) {
if (!endToken || !this.opts.whitespace) return false;
if (!endToken) return false;
var comments = this.ast.comments;