Update test for divide by zero error

This commit is contained in:
Ayrdrie Palmer 2018-06-21 22:41:04 -06:00
parent 09f884b4f0
commit c7a72b9a9d
1 changed files with 3 additions and 3 deletions

View File

@ -983,7 +983,7 @@ func TestSyslogTimestampParser(t *testing.T) {
require.Equal(t, 2018, m.Time().Year())
}
func TestFailDivideByZeroError(t *testing.T) {
func TestEmptyYearInTimestamp(t *testing.T) {
p := &Parser{
Patterns: []string{`%{APPLE_SYSLOG_TIME_SHORT:timestamp:ts-"Jan 2 15:04:05"} %{HOSTNAME} %{APP_NAME:app_name}\[%{NUMBER:pid:int}\]%{GREEDYDATA:message}`},
CustomPatterns: `
@ -992,8 +992,8 @@ func TestFailDivideByZeroError(t *testing.T) {
`,
}
require.NoError(t, p.Compile())
m, err := p.ParseLine("Nov 6 13:57:03 rsavage iTunes[6504]: info> Scale factor of main display = 2.0")
m, err = p.ParseLine("Nov 6 13:57:03 rsavage iTunes[6504]: objc[6504]: Class AMSupportURLConnectionDelegate is implemented in both /System/Library/PrivateFrameworks/EmbeddedOSInstall.framework/Versions/A/EmbeddedOSInstall (0x7fffa594e748) and /System/Library/PrivateFrameworks/MobileDevice.framework/MobileDevice (0x107e67008). One of the two will be used. Which one is undefined.")
p.ParseLine("Nov 6 13:57:03 generic iTunes[6504]: info> Scale factor of main display = 2.0")
m, err := p.ParseLine("Nov 6 13:57:03 generic iTunes[6504]: objc[6504]: Object descriptor was null.")
require.NoError(t, err)
require.NotNil(t, m)
require.Equal(t, 2018, m.Time().Year())