diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-03-12 15:30:20 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2020-03-12 15:30:20 +0900 |
commit | c6633f21a49c90ab7c37076d79c286bbf3438c1f (patch) | |
tree | 74e028c1463c9c13edd8137a55cfbdd31c9aa56b /test | |
parent | f020d340f4eceb2fc809499e3e57924eac4bb75b (diff) | |
download | ruby-c6633f21a49c90ab7c37076d79c286bbf3438c1f.tar.gz |
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
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 5327814f7a..842ae8df49 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 @@ -170,8 +170,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 |