Skip to content

Commit

Permalink
Merge pull request #69 from Jozty/68-remove-example-ran-successful-fr…
Browse files Browse the repository at this point in the history
…om-examples

feat: remove Example ran successful message
  • Loading branch information
singla-shivam authored Jul 4, 2022
2 parents 813f6c7 + 3254075 commit 042b46c
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 16 deletions.
2 changes: 0 additions & 2 deletions examples/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@ const plus5 = Fae.add(5)
console.assert(plus5(3) === 8)
console.assert(plus5(-7) === -2)
console.assert(plus5(0) === 5)

console.log('Example ran successfully')
2 changes: 0 additions & 2 deletions examples/and.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ const andWithTruthyValue = Fae.and(2)
console.assert(andWithTruthyValue(true) === true)
console.assert(andWithTruthyValue('ab') === true)
console.assert(andWithTruthyValue(2) === true)

console.log('Example ran successfully')
2 changes: 0 additions & 2 deletions examples/both.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ const oddGreaterThan5 = Fae.both(isOdd, isGreaterThan5)
console.assert(isBetween5And13(12) === true)
console.assert(oddLessThan1(3) === false)
console.assert(oddGreaterThan5(21) === true)

console.log('Example ran successfully')
2 changes: 0 additions & 2 deletions examples/either.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ const oddOrLessThan1 = Fae.either(isOdd, isLessThan1)
console.assert(is5OrLessThan13(12) === true)
console.assert(isOddOrEquals5(4) === false)
console.assert(oddOrLessThan1(21) === true)

console.log('Example ran successfully')
2 changes: 0 additions & 2 deletions examples/flip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ import * as Fae from 'https://deno.land/x/fae/mod.ts'

// TODO
console.assert(1 === 1)

console.log('Example ran successfully')
2 changes: 0 additions & 2 deletions examples/not.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ console.assert(Fae.not(true) === false)
console.assert(Fae.not('ab') === false)
console.assert(Fae.not([1, 2]) === false)
console.assert(Fae.not({ a: 1, b: 3 }) === false)

console.log('Example ran successfully')
8 changes: 4 additions & 4 deletions run-utils/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
italic,
red,
yellow,
underline,
} from 'https://deno.land/[email protected]/fmt/colors.ts'

const examples: Deno.DirEntry[] = []
Expand Down Expand Up @@ -54,10 +55,11 @@ if (nonZeroExamples.length) {
const name = functionNameForLog(e.name)
const errorCode = red(e.status.code.toString())

return `${name}- ${errorCode}`
return `${name} ${errorCode}`
})
.join('\n')

console.error(underline(red('Some or all examples failed with status codes-\n')))
console.error(statusInfo)
Deno.exit(1)
}
Expand All @@ -79,9 +81,7 @@ const outputs = await Promise.all(
)

const nonEmptyOutputExamples = outputs.filter(
({ output, error }) =>
output.trim() !== 'Example ran successfully' ||
error.includes('Assertion failed'),
({ error }) => error.includes('Assertion failed'),
)

if (nonEmptyOutputExamples.length) {
Expand Down

0 comments on commit 042b46c

Please sign in to comment.