<commit_before>var parser = require("../lib/parser");
var expander = require("../lib/expander");
var expect = require("expect.js");

var enforest = expander.enforest;
var read = parser.read;
var expand = expander.expand;
var flatten = expander.flatten;

describe("enforest", function() {
    it("should enforest a single ident", function() {
        var res = enforest(read("x")[0]);
        expect(res.result.id.token.value).to.be("x");
    });

    it("should enforest a macro definition", function() {
        var res = enforest(read("macro id { case $x => { $x } } fun")[0]);
        expect(res.result.name.token.value).to.be("id");
        expect(res.result.body.length).to.be(5);
        expect(res.rest[0].token.value).to.be("fun")
    });

    it("should enforest a function declaration", function() {
        var res = enforest(read("function id (x) { return x; }")[0]);
        expect(res.result.name.token.value).to.be("id");
        expect(res.result.params.token.inner[0].token.value).to.be("x");
    });

    it("should enforest a VarStatement", function() {
        var res = enforest(read("var x, y")[0]);
        expect(res.result.decls.length).to.be(2);
    });
});

<commit_msg>update enforest test since read now just returns directly<commit_after>var parser = require("../build/lib/parser");
var expander = require("../build/lib/expander");
var expect = require("expect.js");

var enforest = expander.enforest;
var read = parser.read;
var expand = expander.expand;
var flatten = expander.flatten;

describe("enforest", function() {
    it("should enforest a single ident", function() {
        var res = enforest(read("x"));
        expect(res.result.id.token.value).to.be("x");
    });

    it("should enforest a macro definition", function() {
        var res = enforest(read("macro id { case $x => { $x } } fun"));
        expect(res.result.name.token.value).to.be("id");
        expect(res.result.body.length).to.be(5);
        expect(res.rest[0].token.value).to.be("fun")
    });

    it("should enforest a function declaration", function() {
        var res = enforest(read("function id (x) { return x; }"));
        expect(res.result.name.token.value).to.be("id");
        expect(res.result.params.token.inner[0].token.value).to.be("x");
    });

    it("should enforest a VarStatement", function() {
        var res = enforest(read("var x, y"));
        expect(res.result.decls.length).to.be(2);
    });
});


{'fraction_non_alphanumeric': 0.1903199343724364, 'fraction_numerical': 0.004922067268252666, 'mean_word_length': 3.2124352331606216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1963920', 'n_tokens_mistral': 815, 'n_tokens_neox': 780, 'n_words': 161}