93193c7ea5d0e03375a72555ce5fba3e2644d11f
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Tests for parsing/tokenization.
3  * @author Nicholas C. Zakas
4  * @copyright 2014 Nicholas C. Zakas. All rights reserved.
5  */
6
7 //------------------------------------------------------------------------------
8 // Requirements
9 //------------------------------------------------------------------------------
10
11 var shelljs = require("shelljs"),
12     fs = require("fs"),
13     path = require("path");
14
15 //------------------------------------------------------------------------------
16 // Processing
17 //------------------------------------------------------------------------------
18
19 var files = shelljs.find("./tests/fixtures/ast");
20
21 files.filter(function(filename) {
22     return path.extname(filename) === ".json";
23 }).forEach(function(filename) {
24     var basename = path.basename(filename, ".json");
25     exports[basename] = JSON.parse(fs.readFileSync(filename, "utf8"), function(key, value) {
26
27         // JSON can't represent undefined, so we use a special value
28         if (value === "espree@undefined") {
29             return undefined;
30         } else {
31             return value;
32         }
33     });
34 });