caching.js 436 B

1234567891011121314
  1. var Minimatch = require("../minimatch.js").Minimatch
  2. var tap = require("tap")
  3. tap.test("cache test", function (t) {
  4. var mm1 = new Minimatch("a?b")
  5. var mm2 = new Minimatch("a?b")
  6. t.equal(mm1, mm2, "should get the same object")
  7. // the lru should drop it after 100 entries
  8. for (var i = 0; i < 100; i ++) {
  9. new Minimatch("a"+i)
  10. }
  11. mm2 = new Minimatch("a?b")
  12. t.notEqual(mm1, mm2, "cache should have dropped")
  13. t.end()
  14. })