Working on stacked buttons.
This commit is contained in:
+4
-18
@@ -30,32 +30,21 @@ export default class Doctest {
|
||||
static expect(expr, value) {
|
||||
if (this.pprint(expr) != this.pprint(value)) {
|
||||
//throw new Error("got `" + expr + "` but expected `" + value + "`.")
|
||||
throw new Error(
|
||||
'got `' +
|
||||
this.pprint(expr) +
|
||||
'` but expected `' +
|
||||
this.pprint(value) +
|
||||
'`.'
|
||||
)
|
||||
throw new Error('got `' + this.pprint(expr) + '` but expected `' + this.pprint(value) + '`.')
|
||||
}
|
||||
}
|
||||
|
||||
static expectError(error, message) {
|
||||
let index = error.toString().indexOf(message)
|
||||
if (index < 0) {
|
||||
throw new Error(
|
||||
'got `' + message + '` but expected `' + error + '`.'
|
||||
)
|
||||
throw new Error('got `' + message + '` but expected `' + error + '`.')
|
||||
}
|
||||
}
|
||||
|
||||
static expectLog(...messages) {
|
||||
// if (!docTestLogMessages.equals(messages)) {
|
||||
docTestLogMessages.forEach((msg, i) => {
|
||||
if (msg != messages[i])
|
||||
throw new Error(
|
||||
'Unexpected log message: `' + messages[i] + '`.'
|
||||
)
|
||||
if (msg != messages[i]) throw new Error('Unexpected log message: `' + messages[i] + '`.')
|
||||
})
|
||||
// throw new Error('Uups')
|
||||
//}
|
||||
@@ -104,10 +93,7 @@ export default class Doctest {
|
||||
let lines = text.value.split('\n')
|
||||
let better = []
|
||||
for (let line of lines) {
|
||||
if (
|
||||
replaceExpect &&
|
||||
line.trim().startsWith('Doctest.expect(')
|
||||
) {
|
||||
if (replaceExpect && line.trim().startsWith('Doctest.expect(')) {
|
||||
line = line.replace(/Doctest\.expect\(/, '>>> ').trim()
|
||||
if (line.endsWith(')') || line.endsWith(',')) {
|
||||
line = line.slice(0, -1)
|
||||
|
||||
Reference in New Issue
Block a user