Skip to content

Instantly share code, notes, and snippets.

@RichardLitt
Created February 18, 2015 00:45
Show Gist options
  • Select an option

  • Save RichardLitt/d6513707efdb7926ab04 to your computer and use it in GitHub Desktop.

Select an option

Save RichardLitt/d6513707efdb7926ab04 to your computer and use it in GitHub Desktop.
Broken test in static-module
// Works: https://github.com/substack/static-module/blob/master/test/brfs/attribute_vars.js
var x = 5, f = require('fs').readFileSync, y = 2;
var src = f(__dirname + '/x.txt', 'utf8');
console.log(src);
// Broken:
var x = 5, fs = require('fs'), y = 2;
var src = fs.readFileSync(__dirname + '/x.txt', 'utf8');
console.log(src);
@RichardLitt
Copy link
Author

Result of the broken test:

not ok 5 should be equal
  ---
    operator: equal
    expected:
      'var x = 5, y = 2;\nvar src = "beep boop\\n";\nconsole.log(src);\n'
    actual:
      'var x = 5, y = 2"beep boop\\n"\nvar src = ;\nconsole.log(src);\n'
    at: ConcatStream.<anonymous> (/Users/richard/src/static-module/node_modules/concat-stream/index.js:32:43)
  ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment