Skip to content

Commit

Permalink
🔧 add regex assertion tests to LogRecordTest suite
Browse files Browse the repository at this point in the history
  • Loading branch information
mreyes committed Jun 26, 2024
1 parent 24c7d68 commit e0366d7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions source/Bell-Logging-Tests/LogRecordTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ LogRecordTest >> runMemoryLoggerDuring: aBlock assertingLogRecordsMatch: expecte
assertLogRecordsMatch: expectedLogEntries
]

{ #category : #private }
LogRecordTest >> runMemoryLoggerDuring: aBlock assertingLogRecordsMatchRegexes: expectedLogEntries [

loggingAsserter
runMemoryLoggerDuring: aBlock;
assertLogRecordsMatchRegexes: expectedLogEntries
]

{ #category : #running }
LogRecordTest >> setUp [

Expand Down Expand Up @@ -47,6 +55,28 @@ LogRecordTest >> testEmitCombinedEvents [
'[ERROR] Starting app... [FAILED]' )
]

{ #category : #tests }
LogRecordTest >> testEmitCombinedEventsWithRegex [

self
runMemoryLoggerDuring: [
self
should: [
LogRecord emitInfo: 'Starting app' during: [
LogRecord emitInfo: 'Setting up data'.
LogRecord emitWarning: 'Missing data, using default.'.
Error signal
]
]
raise: Error
]
assertingLogRecordsMatchRegexes:
#( '.+ \[INFO].+\.{0,3}'
'.+ \[INFO].+\.{0,1}'
'.+ \[WARNING].+\.{0,1}'
'.+ \[ERROR].+( \[FAILED\])?\.{0,1}' )
]
{ #category : #tests }
LogRecordTest >> testEmitDebug [
Expand Down

0 comments on commit e0366d7

Please sign in to comment.