Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
sometimes the bin mapping is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
othiym23 committed Feb 10, 2015
1 parent 81fd5f7 commit 709976e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions read-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ function checkBinReferences_ (file, data, warn, cb) {

var keys = Object.keys(data.bin)
var keysLeft = keys.length
if (!keysLeft) return cb()

function handleExists(relName, result) {
keysLeft--
Expand Down
11 changes: 10 additions & 1 deletion test/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var createWarningCollector = function () {
return warn
}

console.error("Bin test")
tap.test("Bin test", function (t) {
var p = path.resolve(__dirname, "fixtures/bin.json")
var warn = createWarningCollector()
Expand All @@ -32,3 +31,13 @@ tap.test("Bad bin test", function (t) {
t.end()
})
})

tap.test("Empty bin test", function (t) {
var p = path.resolve(__dirname, "fixtures/emptybin.json")
var warn = createWarningCollector()
readJson(p, warn, function (er, data) {
t.equals(warn.warnings.length, 0)
t.same(data.bin, {}, "no mapping to bin because object was empty")
t.end()
})
})

0 comments on commit 709976e

Please sign in to comment.