var test = require('tap').test,
    join = require('path').join,
    log = require('../lib/log'),
    fn = require('../lib/lintifier');


log.pause();

test('lint ./fixtures/lintfree', function(t) {
    
    function cb(err, msg) {
        t.equal(err, null);
        t.equal(msg, 'Done. No lint found in 1 js files.');
    }
    
    t.plan(2);
    fn([join(__dirname, '/fixtures/lintfree')], ['ignored'], cb);
});

test('lint ./fixtures/linty', function(t) {
    
    function cb(err, msg) {
        var files = Object.keys(err);//console.log(err);

        t.equal(files.length, 2);
        t.equal(err[files[0]].length, 7);
        t.equal(err[files[0]][0].msg,  "Expected ';' and instead saw 'function'.");
        t.equal(err[files[0]][1].msg,  "Missing 'use strict' statement.");
        t.equal(err[files[0]][2].msg,  "['bar'] is better written in dot notation.");
        t.equal(msg, null);
    }
    
    t.plan(6);
    fn([join(__dirname, '/fixtures/linty')], ['ignored'], cb);
});

test('lint nonesuch', function(t) {
    
    function cb(err, msg) {
        t.equal(err, 'nonesuch does not exist.');
        t.equal(msg, undefined);
    }
    
    t.plan(2);
    fn(['nonesuch'], [], cb);
});

@@ -184,36 +184,32 @@
 , function(t) %7B%0A
-    
 %0A    function cb
@@ -307,36 +307,32 @@
 files.');%0A    %7D%0A
-    
 %0A    t.plan(2);%0A
@@ -433,150 +433,411 @@
 inty
-', function(t) %7B%0A    %0A    function cb(err, msg) %7B%0A        var files = Object.keys(err);//console.log(err);%0A%0A        t.equal(files.length, 2
+ (fubar.js symlinked)', function(t) %7B%0A    var dir = join(__dirname, '/fixtures/linty'),%0A        fubarpath = join(dir, 'fubar.js'),%0A        only1path = join(dir, 'only-one-error.js');%0A%0A    function cb(err, msg) %7B%0A        var files = Object.keys(err),%0A            fubarlint = err%5Bfubarpath%5D,%0A            only1lint = err%5Bonly1path%5D;%0A%0A        t.equal(files.length, 2, 'expected 2 files with lint errors'
 );%0A
+%0A
     
@@ -852,31 +852,228 @@
 ual(
-err%5Bfiles%5B0%5D%5D.length, 7
+only1lint.length, 1, 'expected 1 lint offense in %22only-one-error.js%22');%0A        t.equal(only1lint%5B0%5D.msg, %22Missing 'use strict' statement.%22);%0A%0A        t.equal(fubarlint.length, 7, 'expected 7 lint offenses in %22fubar.js%22'
 );%0A 
@@ -1091,29 +1091,25 @@
 ual(
-err%5Bfiles%5B0%5D%5D
+fubarlint
 %5B0%5D.msg,
   %22E
@@ -1104,17 +1104,16 @@
 %5B0%5D.msg,
- 
  %22Expect
@@ -1170,29 +1170,25 @@
 ual(
-err%5Bfiles%5B0%5D%5D
+fubarlint
 %5B1%5D.msg,
   %22M
@@ -1183,17 +1183,16 @@
 %5B1%5D.msg,
- 
  %22Missin
@@ -1240,29 +1240,25 @@
 ual(
-err%5Bfiles%5B0%5D%5D
+fubarlint
 %5B2%5D.msg,
   %22%5B
@@ -1253,17 +1253,16 @@
 %5B2%5D.msg,
- 
  %22%5B'bar'
@@ -1297,24 +1297,25 @@
 otation.%22);%0A
+%0A
         t.eq
@@ -1328,36 +1328,32 @@
 g, null);%0A    %7D%0A
-    
 %0A    t.plan(6);%0A
@@ -1352,9 +1352,9 @@
 lan(
-6
+8
 );%0A 
@@ -1364,42 +1364,11 @@
 fn(%5B
-join(__dirname, '/fixtures/linty')
+dir
 %5D, %5B
@@ -1425,20 +1425,16 @@
 on(t) %7B%0A
-    
 %0A    fun
@@ -1543,20 +1543,16 @@
 ;%0A    %7D%0A
-    
 %0A    t.p

improve test, rm whsp