Skip to content

Commit

Permalink
Code generator tests (babel#5847)
Browse files Browse the repository at this point in the history
  • Loading branch information
1egoman authored and hzoo committed Jul 20, 2017
1 parent c60bf9a commit 0b890ce
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/babel-generator/test/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Printer from "../lib/printer";
import generate from "../lib";
import generate, { CodeGenerator } from "../lib";
import assert from "assert";
import { parse } from "babylon";
import chai from "chai";
Expand Down Expand Up @@ -351,6 +351,14 @@ describe("programmatic generation", function() {
});
});

describe("CodeGenerator", function() {
it("generate", function() {
const codeGen = new CodeGenerator(t.numericLiteral(123));
const code = codeGen.generate().code;
assert.equal(parse(code).program.body[0].expression.value, 123);
});
});

const suites = fixtures(`${__dirname}/fixtures`);

suites.forEach(function(testSuite) {
Expand Down

0 comments on commit 0b890ce

Please sign in to comment.