"use strict";
import { parse } from "../lib/parser";
import { Printer } from "../lib/printer";
import assert from "assert";
import * as types from "ast-types";
const nodeMajorVersion = parseInt(process.versions.node, 10);
for (const { title, parser } of [
{ title: "Babel JSX Compatibility", parser: require("../parsers/babel") },
{ title: "Esprima JSX Compatibility", parser: require("../parsers/esprima") },
]) {
(nodeMajorVersion >= 6 ? describe : xdescribe)(title, function () {
const printer = new Printer({ tabWidth: 2 });
const parseOptions = { parser };
function check(source: string) {
const ast1 = parse(source, parseOptions);
const ast2 = parse(printer.printGenerically(ast1).code, parseOptions);
types.astNodesAreEquivalent.assert(ast1, ast2);
}
it("should parse and print attribute comments", function () {
check("");
check("");
});
it("should parse and print child comments", function () {
check("{/* comment */}");
check("{/* multi\nline\ncomment */}");
});
it("should parse and print literal attributes", function () {
check('');
});
it("should parse and print expression attributes", function () {
check("");
});
it("should parse and print chidren", function () {
check("");
});
it("should parse and print literal chidren", function () {
check("hello world");
});
it("should parse and print expression children", function () {
check("{this.props.user.name}");
});
it("should parse and print namespaced elements", function () {
check("