Update test for divide by zero error
This commit is contained in:
parent
09f884b4f0
commit
c7a72b9a9d
|
@ -983,7 +983,7 @@ func TestSyslogTimestampParser(t *testing.T) {
|
||||||
require.Equal(t, 2018, m.Time().Year())
|
require.Equal(t, 2018, m.Time().Year())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFailDivideByZeroError(t *testing.T) {
|
func TestEmptyYearInTimestamp(t *testing.T) {
|
||||||
p := &Parser{
|
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}`},
|
Patterns: []string{`%{APPLE_SYSLOG_TIME_SHORT:timestamp:ts-"Jan 2 15:04:05"} %{HOSTNAME} %{APP_NAME:app_name}\[%{NUMBER:pid:int}\]%{GREEDYDATA:message}`},
|
||||||
CustomPatterns: `
|
CustomPatterns: `
|
||||||
|
@ -992,8 +992,8 @@ func TestFailDivideByZeroError(t *testing.T) {
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
require.NoError(t, p.Compile())
|
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")
|
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 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.")
|
m, err := p.ParseLine("Nov 6 13:57:03 generic iTunes[6504]: objc[6504]: Object descriptor was null.")
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.NotNil(t, m)
|
require.NotNil(t, m)
|
||||||
require.Equal(t, 2018, m.Time().Year())
|
require.Equal(t, 2018, m.Time().Year())
|
||||||
|
|
Loading…
Reference in New Issue