diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2020-03-20 14:31:10 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2020-03-20 14:31:10 +0000 |
commit | f2ba3a0c45fd83daa326cc28b6410760691c0e54 (patch) | |
tree | aaa50cea94066a120eee4b5c99821e7413b09262 /test | |
parent | 36e9ed7fef6eb2d14becf6c52452e4ab16e4bf01 (diff) |
merge revision(s) c6633f21a49c90ab7c37076d79c286bbf3438c1f:
Update some syslog tests to absurb the format change of FreeBSD
syslog
FreeBSD
```
$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
rubyspec 78462 - - Hello
```
Linux
```
$ ruby -rsyslog -e 'Syslog.open("rubyspec", Syslog::LOG_PERROR) {|s| s.log(Syslog::LOG_ALERT, "Hello") }'
rubyspec: Hello
```
https://github.com/freebsd/freebsd/commit/591ef7c8076109cff3c41f9bb50da996a34121e9
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/test_syslog.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/test/test_syslog.rb b/test/test_syslog.rb index c66e5f5fb2..2a7476191e 100644 --- a/test/test_syslog.rb +++ b/test/test_syslog.rb @@ -113,7 +113,7 @@ class TestSyslog < Test::Unit::TestCase end def syslog_line_regex(ident, message) - /(?:^| )#{Regexp.quote(ident)}(?:\[([1-9][0-9]*)\])?(?: |[: ].* )#{Regexp.quote(message)}$/ + /(?:^| )#{Regexp.quote(ident)}(?:\[([1-9][0-9]*)\])?(?: | ([1-9][0-9]*) - - ||[: ].* )#{Regexp.quote(message)}$/ end def test_log @@ -168,8 +168,9 @@ class TestSyslog < Test::Unit::TestCase end m = re.match(line) assert_not_nil(m) - assert_not_nil(m[1]) - assert_equal(pid, m[1].to_i) + output_pid = m[1] || m[2] + assert_not_nil(output_pid) + assert_equal(pid, output_pid.to_i) } } end |