corrections for rngState 82b19a3e7604cf825d

This commit is contained in:
El RIDO 2017-03-25 10:47:12 +01:00
parent e15e86ac3f
commit 145cfccfcb
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92

View File

@ -195,9 +195,10 @@ describe('Helper', function () {
'(small nearray) string', '(small nearray) string',
'string', 'string',
function (prefix, params, postfix) { function (prefix, params, postfix) {
var prefix = prefix.replace(/%(s|d)/g, '%%'), prefix = prefix.replace(/%(s|d)/g, '%%');
postfix = postfix.replace(/%(s|d)/g, '%%'), params[0] = params[0].replace(/%(s|d)/g, '%%');
result = prefix + params[0] + postfix; postfix = postfix.replace(/%(s|d)/g, '%%');
var result = prefix + params[0] + postfix;
params.unshift(prefix + '%s' + postfix); params.unshift(prefix + '%s' + postfix);
return result === $.PrivateBin.Helper.sprintf.apply(this, params); return result === $.PrivateBin.Helper.sprintf.apply(this, params);
} }
@ -208,9 +209,9 @@ describe('Helper', function () {
'(small nearray) nat', '(small nearray) nat',
'string', 'string',
function (prefix, params, postfix) { function (prefix, params, postfix) {
var prefix = prefix.replace(/%(s|d)/g, '%%'), prefix = prefix.replace(/%(s|d)/g, '%%');
postfix = postfix.replace(/%(s|d)/g, '%%'), postfix = postfix.replace(/%(s|d)/g, '%%');
result = prefix + params[0] + postfix; var result = prefix + params[0] + postfix;
params.unshift(prefix + '%d' + postfix); params.unshift(prefix + '%d' + postfix);
return result === $.PrivateBin.Helper.sprintf.apply(this, params); return result === $.PrivateBin.Helper.sprintf.apply(this, params);
} }
@ -221,9 +222,9 @@ describe('Helper', function () {
'(small nearray) falsy', '(small nearray) falsy',
'string', 'string',
function (prefix, params, postfix) { function (prefix, params, postfix) {
var prefix = prefix.replace(/%(s|d)/g, '%%'), prefix = prefix.replace(/%(s|d)/g, '%%');
postfix = postfix.replace(/%(s|d)/g, '%%'), postfix = postfix.replace(/%(s|d)/g, '%%');
result = prefix + '0' + postfix; var result = prefix + '0' + postfix;
params.unshift(prefix + '%d' + postfix); params.unshift(prefix + '%d' + postfix);
return result === $.PrivateBin.Helper.sprintf.apply(this, params) return result === $.PrivateBin.Helper.sprintf.apply(this, params)
} }
@ -236,9 +237,10 @@ describe('Helper', function () {
'string', 'string',
'string', 'string',
function (prefix, uint, middle, string, postfix) { function (prefix, uint, middle, string, postfix) {
var prefix = prefix.replace(/%(s|d)/g, '%%'), prefix = prefix.replace(/%(s|d)/g, '%%');
postfix = postfix.replace(/%(s|d)/g, '%%'), middle = middle.replace(/%(s|d)/g, '%%');
params = [prefix + '%d' + middle + '%s' + postfix, uint, string], postfix = postfix.replace(/%(s|d)/g, '%%');
var params = [prefix + '%d' + middle + '%s' + postfix, uint, string],
result = prefix + uint + middle + string + postfix; result = prefix + uint + middle + string + postfix;
return result === $.PrivateBin.Helper.sprintf.apply(this, params); return result === $.PrivateBin.Helper.sprintf.apply(this, params);
} }
@ -251,9 +253,10 @@ describe('Helper', function () {
'string', 'string',
'string', 'string',
function (prefix, uint, middle, string, postfix) { function (prefix, uint, middle, string, postfix) {
var prefix = prefix.replace(/%(s|d)/g, '%%'), prefix = prefix.replace(/%(s|d)/g, '%%');
postfix = postfix.replace(/%(s|d)/g, '%%'), middle = middle.replace(/%(s|d)/g, '%%');
params = [prefix + '%s' + middle + '%d' + postfix, string, uint], postfix = postfix.replace(/%(s|d)/g, '%%');
var params = [prefix + '%s' + middle + '%d' + postfix, string, uint],
result = prefix + string + middle + uint + postfix; result = prefix + string + middle + uint + postfix;
return result === $.PrivateBin.Helper.sprintf.apply(this, params); return result === $.PrivateBin.Helper.sprintf.apply(this, params);
} }
@ -336,6 +339,7 @@ describe('I18n', function () {
'returns message ID unchanged if no translation found', 'returns message ID unchanged if no translation found',
'string', 'string',
function (messageId) { function (messageId) {
messageId = messageId.replace(/%(s|d)/g, '%%');
var result = $.PrivateBin.I18n.translate(messageId); var result = $.PrivateBin.I18n.translate(messageId);
$.PrivateBin.I18n.reset(); $.PrivateBin.I18n.reset();
var alias = $.PrivateBin.I18n._(messageId); var alias = $.PrivateBin.I18n._(messageId);
@ -349,9 +353,10 @@ describe('I18n', function () {
'(small nearray) string', '(small nearray) string',
'string', 'string',
function (prefix, params, postfix) { function (prefix, params, postfix) {
var prefix = prefix.replace(/%(s|d)/g, '%%'), prefix = prefix.replace(/%(s|d)/g, '%%');
postfix = postfix.replace(/%(s|d)/g, '%%'), params[0] = params[0].replace(/%(s|d)/g, '%%');
translation = prefix + params[0] + postfix; postfix = postfix.replace(/%(s|d)/g, '%%');
var translation = prefix + params[0] + postfix;
params.unshift(prefix + '%s' + postfix); params.unshift(prefix + '%s' + postfix);
var result = $.PrivateBin.I18n.translate.apply(this, params); var result = $.PrivateBin.I18n.translate.apply(this, params);
$.PrivateBin.I18n.reset(); $.PrivateBin.I18n.reset();