diff options
author | John Hawthorn <john@hawthorn.email> | 2021-06-02 08:15:39 -0700 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:35 -0400 |
commit | ea33b0a9baa26e96b1a34d7823ec0235d0e0bd90 (patch) | |
tree | a26be9134b7a367ff00d4c63757ba42e8929923f /bootstraptest | |
parent | eb6e5be038a94c622f09188c957370d86650628c (diff) |
Add concatstrings to yjit codegen (#58)
* Add ETYPE_TRUE and ETYPE_FALSE
* Implement checktype
* Implement concatstrings
* Update deps
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_yjit.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 51b4a9b85f..5bf415889e 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -977,3 +977,47 @@ assert_equal '{:foo=>:bar}', %q{ build_hash(:bar) build_hash(:bar) } + +# test string interpolation with known types +assert_equal 'foobar', %q{ + def make_str + foo = -"foo" + bar = -"bar" + "#{foo}#{bar}" + end + + make_str + make_str +} + +# test string interpolation with unknown types +assert_equal 'foobar', %q{ + def make_str(foo, bar) + "#{foo}#{bar}" + end + + make_str("foo", "bar") + make_str("foo", "bar") +} + +# test string interpolation with known non-strings +assert_equal 'foo123', %q{ + def make_str + foo = -"foo" + bar = 123 + "#{foo}#{bar}" + end + + make_str + make_str +} + +# test string interpolation with unknown non-strings +assert_equal 'foo123', %q{ + def make_str(foo, bar) + "#{foo}#{bar}" + end + + make_str("foo", 123) + make_str("foo", 123) +} |