var assert = require("assert");
var util   = require("../lib/6to5/util");

suite("util", function () {
  test("duplicate mutator map", function () {
    var map = {
      test: {
        get: {}
      }
    };

    assert.throws(function () {
      util.pushMutatorMap(map, "test", "get", {});
    }, /a get already exists for this property/);
  });

  test("invalid template", function () {
    assert.throws(function () {
      util.template("invalid template");
    }, /unknown template/);
  });

  test("canCompile", function () {
    assert.ok(util.canCompile("test.js"));
    assert.ok(util.canCompile("/test.js"));
    assert.ok(util.canCompile("/scripts/test.js"));

    assert.ok(util.canCompile("test.es6"));
    assert.ok(util.canCompile("/test.es6"));
    assert.ok(util.canCompile("/scripts/test.es6"));

    assert.ok(!util.canCompile("test"));
    assert.ok(!util.canCompile("test.css"));
    assert.ok(!util.canCompile("/test.css"));
    assert.ok(!util.canCompile("/scripts/test.css"));
  });

  test("isAbsolute", function () {
    assert.ok(util.isAbsolute("/test.js"));
    assert.ok(util.isAbsolute("C:\\test.js"));

    assert.ok(!util.isAbsolute());
    assert.ok(!util.isAbsolute(""));
    assert.ok(!util.isAbsolute("test.js"));
    assert.ok(!util.isAbsolute("test/test.js"));
  });

  test("getIds");

  test("isReferenced");

  test("removeProperties");

  test("ensureBlock");

  test("pushMutatorMap");
});

@@ -1295,32 +1295,353 @@
 t.js%22));%0A  %7D);%0A%0A
+  test(%22list%22, function () %7B%0A    assert.deepEqual(util.list(undefined), %5B%5D);%0A    assert.deepEqual(util.list(false), %5B%5D);%0A    assert.deepEqual(util.list(null), %5B%5D);%0A    assert.deepEqual(util.list(%22%22), %5B%5D);%0A    assert.deepEqual(util.list(%22foo%22), %5B%22foo%22%5D);%0A    assert.deepEqual(util.list(%22foo,bar%22), %5B%22foo%22, %22bar%22%5D);%0A  %7D);%0A%0A
   test(%22getIds%22)

add util list test