[ospec] Simplify the dupe checker
This commit is contained in:
parent
a7ea060a64
commit
396a7ff4e4
1 changed files with 3 additions and 6 deletions
|
|
@ -110,15 +110,12 @@ module.exports = new function init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var dedupeCounter = 0
|
|
||||||
function unique(subject) {
|
function unique(subject) {
|
||||||
var res = subject
|
if (hasOwn.call(ctx, subject)) {
|
||||||
if (ctx.hasOwnProperty(subject)) {
|
|
||||||
console.warn("A test or a spec named `" + subject + "` was already defined")
|
console.warn("A test or a spec named `" + subject + "` was already defined")
|
||||||
while (ctx.hasOwnProperty(res)) res = subject + ' (' + ++dedupeCounter + ')'
|
while (hasOwn.call(ctx, subject)) subject += '*'
|
||||||
dedupeCounter = 0
|
|
||||||
}
|
}
|
||||||
return res
|
return subject
|
||||||
}
|
}
|
||||||
function hook(name) {
|
function hook(name) {
|
||||||
return function(predicate) {
|
return function(predicate) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue