Skip to content

Commit

Permalink
Allow "-" for directory name in TestThread (#4917)
Browse files Browse the repository at this point in the history
When I run this test class on Travis CI,
some tests fail because on Travis CI
directrory name includes my account name,
so inspected result becomes:

```
<"#<Thread:0x7cf50001@foo@/home/travis/build/yui-knk/jruby/test/jruby/test_thread.rb:368 run>">
```

which does not match `</\#\<Thread\:0x\h+@foo(@[\w\/\._]+\:\d+)?\srun\>/>`.
yui-knk authored and kares committed Dec 29, 2017
1 parent 7bd10a6 commit 556d339
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/jruby/test_thread.rb
Original file line number Diff line number Diff line change
@@ -360,22 +360,22 @@ def test_inspect_and_to_s

def test_thread_name
Thread.new do
assert_match(/\#\<Thread\:0x\h+(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/\#\<Thread\:0x\h+(@[\w\/\.\-_]+\:\d+)?\srun\>/, Thread.current.inspect)
# TODO? currently in JIT file comes as "" and line as 0
assert_match(/Ruby\-\d+\-Thread\-\d+\:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION
end.join

Thread.new do
Thread.current.name = 'foo'
assert_match(/\#\<Thread\:0x\h+@foo(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/\#\<Thread\:0x\h+@foo(@[\w\/\.\-_]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/Ruby\-\d+\-Thread\-\d+\@foo:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION

Thread.current.name = 'bar'
assert_match(/\#\<Thread\:0x\h+@bar(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/\#\<Thread\:0x\h+@bar(@[\w\/\.\-_]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/Ruby\-\d+\-Thread\-\d+\@bar:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION

Thread.current.name = nil
assert_match(/\#\<Thread\:0x\h+(@[\w\/\._]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/\#\<Thread\:0x\h+(@[\w\/\.\-_]+\:\d+)?\srun\>/, Thread.current.inspect)
assert_match(/Ruby\-\d+\-Thread\-\d+\:\s(.*\.rb)?\:\d+/, native_thread_name(Thread.current)) if defined? JRUBY_VERSION
end.join

0 comments on commit 556d339

Please sign in to comment.