зеркало из https://github.com/mozilla/pjs.git
Bug 557591 - Add tests for Utils.makeGUID.
This commit is contained in:
Родитель
425168f5ce
Коммит
24f449dae0
|
@ -0,0 +1,15 @@
|
|||
_("Make sure makeGUID makes guids of the right length/characters");
|
||||
Cu.import("resource://weave/util.js");
|
||||
|
||||
function run_test() {
|
||||
// XXX this could cause random failures as guids arent always unique...
|
||||
_("Create a bunch of guids to make sure they don't conflict");
|
||||
let guids = [];
|
||||
for (let i = 0; i < 1000; i++) {
|
||||
let newGuid = Utils.makeGUID();
|
||||
_("Making sure guid has the right length without special characters:", newGuid);
|
||||
do_check_eq(encodeURIComponent(newGuid).length, 10);
|
||||
do_check_true(guids.every(function(g) g != newGuid));
|
||||
guids.push(newGuid);
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче