Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should use the built-in Logger', () => {
const pipe = Opal.StringIO.$new()
const logger = Opal.Logger.$new(pipe)
const now = new Date()
logger.$add(2, 'hello', 'asciidoctor')
const message = pipe.$string()
expect(message).to.contain('WARN -- asciidoctor: hello')
expect(message).to.contain('W, [')
const datetime = /W, \[([^\]]+)].*/g.exec(message)[1]
const datetimeRegexp = new RegExp(/([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})\.([0-9]{6})/)
const result = datetimeRegexp.exec(datetime)
const year = parseInt(result[1])
const month = parseInt(result[2])
const day = parseInt(result[3])
const hours = parseInt(result[4])
const minutes = parseInt(result[5])
const seconds = parseInt(result[6])
const nowYear = now.getFullYear()