[前][次][番号順一覧][スレッド一覧]

ruby-changes:69267

From: John <ko1@a...>
Date: Thu, 21 Oct 2021 08:24:25 +0900 (JST)
Subject: [ruby-changes:69267] a68e61f089 (master): Add tests against side exits for non-fixnum

https://git.ruby-lang.org/ruby.git/commit/?id=a68e61f089

From a68e61f08904ecc5a8b551a90894475da2f0ae9b Mon Sep 17 00:00:00 2001
From: John Hawthorn <john@h...>
Date: Tue, 14 Sep 2021 09:07:35 -0700
Subject: Add tests against side exits for non-fixnum

---
 test/ruby/test_yjit.rb | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb
index 10eb4aa476..23a2675be1 100644
--- a/test/ruby/test_yjit.rb
+++ b/test/ruby/test_yjit.rb
@@ -105,6 +105,47 @@ class TestYJIT < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_yjit.rb#L105
     RUBY
   end
 
+  def test_compile_opt_lt
+    assert_compiles('1 < 2', insns: %i[opt_lt])
+    assert_compiles('"a" < "b"', insns: %i[opt_lt])
+  end
+
+  def test_compile_opt_le
+    assert_compiles('1 <= 2', insns: %i[opt_le])
+    assert_compiles('"a" <= "b"', insns: %i[opt_le])
+  end
+
+  def test_compile_opt_gt
+    assert_compiles('1 > 2', insns: %i[opt_gt])
+    assert_compiles('"a" > "b"', insns: %i[opt_gt])
+  end
+
+  def test_compile_opt_ge
+    assert_compiles('1 >= 2', insns: %i[opt_ge])
+    assert_compiles('"a" >= "b"', insns: %i[opt_ge])
+  end
+
+  def test_compile_opt_plus
+    assert_compiles('1 + 2', insns: %i[opt_plus])
+    assert_compiles('"a" + "b"', insns: %i[opt_plus])
+    assert_compiles('[:foo] + [:bar]', insns: %i[opt_plus])
+  end
+
+  def test_compile_opt_minus
+    assert_compiles('1 - 2', insns: %i[opt_minus])
+    assert_compiles('[:foo, :bar] - [:bar]', insns: %i[opt_minus])
+  end
+
+  def test_compile_opt_or
+    assert_compiles('1 | 2', insns: %i[opt_or])
+    assert_compiles('[:foo] | [:bar]', insns: %i[opt_or])
+  end
+
+  def test_compile_opt_and
+    assert_compiles('1 & 2', insns: %i[opt_and])
+    assert_compiles('[:foo, :bar] & [:bar]', insns: %i[opt_and])
+  end
+
   def test_compile_set_and_get_global
     assert_compiles('$foo = 123; $foo', insns: %i[setglobal], result: 123)
   end
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]