'use strict';

var bluebird = require('bluebird');
var fs       = bluebird.promisifyAll(require('fs'));
var hljs     = require('../../build');
var path     = require('path');
var utility  = require('../utility');

function testAutoDetection(language) {
  var languagePath = utility.buildPath('detect', language);

  it(`should have test for ${language}`, function() {
    return fs.statAsync(languagePath)
      .then(path => path.isDirectory().should.be.true);
  });

  it(`should be detected as ${language}`, function() {
    return fs.readdirAsync(languagePath)
      .map(function(example) {
        var filename = path.join(languagePath, example);

        return fs.readFileAsync(filename, 'utf-8');
      })
      .each(function(content) {
        var expected = language,
            actual   = hljs.highlightAuto(content).language;

        actual.should.equal(expected);
      });
  });
}

describe('hljs.highlightAuto()', function() {
  var languages = hljs.listLanguages();

  languages.forEach(testAutoDetection);
});

@@ -8,19 +8,19 @@
 rict';%0A%0A
-var
+let
  bluebir
@@ -44,19 +44,19 @@
 bird');%0A
-var
+let
  fs     
@@ -97,19 +97,19 @@
 'fs'));%0A
-var
+let
  hljs   
@@ -136,19 +136,19 @@
 uild');%0A
-var
+let
  path   
@@ -168,19 +168,19 @@
 path');%0A
-var
+let
  utility
@@ -244,27 +244,27 @@
 nguage) %7B%0A  
-var
+let
  languagePat
@@ -597,19 +597,19 @@
         
-var
+let
  filenam
@@ -748,19 +748,19 @@
         
-var
+let
  expecte
@@ -945,11 +945,11 @@
 %7B%0A  
-var
+let
  lan

Use let in the detect test suite