Avoid duplicating a math-closing dollar sign (#11227)

GitOrigin-RevId: ef2ef77e26df59d1af3df6dc664e284d3c70102d
This commit is contained in:
Alf Eaton
2023-01-16 08:41:42 +00:00
committed by Copybot
parent 377a8aed60
commit ee85d948e2
268 changed files with 57782 additions and 0 deletions
@@ -0,0 +1,35 @@
/**
* @typedef {import("../..").Blob } Blob
*/
/**
* @template T
* @typedef {import("bluebird")<T>} BPromise
*/
/**
* Fake blob store for tests
*/
class FakeBlobStore {
/**
* Get a string from the blob store
*
* @param {string} hash
* @return {BPromise<string>}
*/
getString(hash) {
throw new Error('Not implemented')
}
/**
* Store a string in the blob store
*
* @param {string} content
* @return {BPromise<Blob>}
*/
putString(content) {
throw new Error('Not implemented')
}
}
module.exports = FakeBlobStore
@@ -0,0 +1,38 @@
//
// Randomised testing helpers from OT.js:
// https://github.com/Operational-Transformation/ot.js/blob/
// 8873b7e28e83f9adbf6c3a28ec639c9151a838ae/test/helpers.js
//
'use strict'
function randomInt(n) {
return Math.floor(Math.random() * n)
}
function randomString(n) {
let str = ''
while (n--) {
if (Math.random() < 0.15) {
str += '\n'
} else {
const chr = randomInt(26) + 97
str += String.fromCharCode(chr)
}
}
return str
}
function randomElement(arr) {
return arr[randomInt(arr.length)]
}
function randomTest(numTrials, test) {
return function () {
while (numTrials--) test()
}
}
exports.int = randomInt
exports.string = randomString
exports.element = randomElement
exports.test = randomTest