less 1.4.0-b3 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/test/less-test.js CHANGED
@@ -5,6 +5,8 @@ var path = require('path'),
5
5
  var less = require('../lib/less');
6
6
  var stylize = require('../lib/less/lessc_helper').stylize;
7
7
 
8
+ var globals = Object.keys(global);
9
+
8
10
  var oneTestOnly = process.argv[2];
9
11
 
10
12
  var totalTests = 0,
@@ -23,9 +25,9 @@ less.tree.functions._color = function (str) {
23
25
 
24
26
  sys.puts("\n" + stylize("LESS", 'underline') + "\n");
25
27
 
26
- runTestSet({relativeUrls: true, silent: true});
28
+ runTestSet({strictMath: true, relativeUrls: true, silent: true});
27
29
 
28
- runTestSet({strictUnits: true}, "errors/", function(name, err, compiledLess, doReplacements) {
30
+ runTestSet({strictMath: true, strictUnits: true}, "errors/", function(name, err, compiledLess, doReplacements) {
29
31
  fs.readFile(path.join('test/less/', name) + '.txt', 'utf8', function (e, expectedErr) {
30
32
  sys.print("- " + name + ": ");
31
33
  expectedErr = doReplacements(expectedErr, 'test/less/errors/');
@@ -53,15 +55,16 @@ runTestSet({strictUnits: true}, "errors/", function(name, err, compiledLess, doR
53
55
  .replace(/\r\n/g, '\n');
54
56
  });
55
57
 
56
- runTestSet({dumpLineNumbers: 'comments'}, "debug/", null,
58
+ runTestSet({strictMath: true, dumpLineNumbers: 'comments'}, "debug/", null,
57
59
  function(name) { return name + '-comments'; });
58
- runTestSet({dumpLineNumbers: 'mediaquery'}, "debug/", null,
60
+ runTestSet({strictMath: true, dumpLineNumbers: 'mediaquery'}, "debug/", null,
59
61
  function(name) { return name + '-mediaquery'; });
60
- runTestSet({dumpLineNumbers: 'all'}, "debug/", null,
62
+ runTestSet({strictMath: true, dumpLineNumbers: 'all'}, "debug/", null,
61
63
  function(name) { return name + '-all'; });
62
- runTestSet({relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/");
63
- runTestSet({compress: true}, "compression/");
64
- runTestSet({strictMaths: false}, "legacy/");
64
+ runTestSet({strictMath: true, relativeUrls: false, rootpath: "folder (1)/"}, "static-urls/");
65
+ runTestSet({strictMath: true, compress: true}, "compression/");
66
+ runTestSet({ }, "legacy/");
67
+ testNoOptions();
65
68
 
66
69
  function globalReplacements(input, directory) {
67
70
  var p = path.join(process.cwd(), directory),
@@ -76,6 +79,12 @@ function globalReplacements(input, directory) {
76
79
  .replace(/\r\n/g, '\n');
77
80
  }
78
81
 
82
+ function checkGlobalLeaks() {
83
+ return Object.keys(global).filter(function(v) {
84
+ return globals.indexOf(v) < 0;
85
+ });
86
+ }
87
+
79
88
  function runTestSet(options, foldername, verifyFunction, nameModifier, doReplacements) {
80
89
  foldername = foldername || "";
81
90
 
@@ -146,6 +155,7 @@ function ok(msg) {
146
155
  }
147
156
 
148
157
  function endTest() {
158
+ var leaked = checkGlobalLeaks();
149
159
  if (failedTests + passedTests === totalTests) {
150
160
  sys.puts("");
151
161
  sys.puts("");
@@ -157,6 +167,12 @@ function endTest() {
157
167
  sys.print(stylize("All Passed ", "green"));
158
168
  sys.print(passedTests + " run");
159
169
  }
170
+ if (leaked.length > 0) {
171
+ sys.puts("");
172
+ sys.puts("");
173
+ sys.print(stylize("Global leak detected: ", "red") + leaked.join(', '));
174
+ sys.print("\n");
175
+ }
160
176
  }
161
177
  }
162
178
 
@@ -184,3 +200,15 @@ function toCSS(options, path, callback) {
184
200
  });
185
201
  });
186
202
  }
203
+
204
+ function testNoOptions() {
205
+ totalTests++;
206
+ try {
207
+ sys.print("- Integration - creating parser without options: ");
208
+ new(less.Parser);
209
+ } catch(e) {
210
+ fail(stylize("FAIL\n", "red"));
211
+ return;
212
+ }
213
+ ok(stylize("OK\n", "green"));
214
+ }
package/.gitattributes DELETED
@@ -1,9 +0,0 @@
1
- *.js text eol=lf
2
- lessc text eol=lf
3
- *.less text eol=lf
4
- *.css text eol=lf
5
- *.htm text eol=lf
6
-
7
- *.jpg binary
8
- *.png binary
9
- *.jpeg binary