Started porting JSX support from esprima-fb.
Conflicts: acorn.js test/tests.js
This commit is contained in:
53
test/tests-jsx.js
Normal file
53
test/tests-jsx.js
Normal file
@@ -0,0 +1,53 @@
|
||||
// React JSX tests
|
||||
|
||||
if (typeof exports != "undefined") {
|
||||
var test = require("./driver.js").test;
|
||||
var testFail = require("./driver.js").testFail;
|
||||
var testAssert = require("./driver.js").testAssert;
|
||||
}
|
||||
|
||||
test('<a />', {
|
||||
type: 'Program',
|
||||
body: [
|
||||
{
|
||||
type: "ExpressionStatement",
|
||||
expression: {
|
||||
type: "XJSElement",
|
||||
openingElement: {
|
||||
type: "XJSOpeningElement",
|
||||
name: {
|
||||
type: "XJSIdentifier",
|
||||
name: "a",
|
||||
start: 1,
|
||||
end: 2,
|
||||
loc: {
|
||||
start: { line: 1, column: 1 },
|
||||
end: { line: 1, column: 2 }
|
||||
}
|
||||
},
|
||||
selfClosing: true,
|
||||
attributes: [],
|
||||
start: 0,
|
||||
end: 5,
|
||||
loc: {
|
||||
start: { line: 1, column: 0 },
|
||||
end: { line: 1, column: 5 }
|
||||
}
|
||||
},
|
||||
children: [],
|
||||
start: 0,
|
||||
end: 5,
|
||||
loc: {
|
||||
start: { line: 1, column: 0 },
|
||||
end: { line: 1, column: 5 }
|
||||
}
|
||||
},
|
||||
start: 0,
|
||||
end: 5,
|
||||
loc: {
|
||||
start: { line: 1, column: 0 },
|
||||
end: { line: 1, column: 5 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}, {locations: true});
|
||||
@@ -6,6 +6,7 @@ if (typeof exports != "undefined") {
|
||||
var testFail = require("./driver.js").testFail;
|
||||
var testAssert = require("./driver.js").testAssert;
|
||||
var acorn = require("..");
|
||||
require("./tests-jsx.js");
|
||||
}
|
||||
|
||||
test("this\n", {
|
||||
|
||||
Reference in New Issue
Block a user