summaryrefslogtreecommitdiff
path: root/test/-ext-/econv/test_append.rb
blob: f8c1d2add690a2165e00671068990a7fa22ec138 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: false
require 'test/unit'
require "-test-/econv"

class Test_EConvAppend < Test::Unit::TestCase
  def test_econv_str_append_valid
    ec = Bug::EConv.new("utf-8", "cp932")
    dst = "\u3044".encode("cp932")
    ret = ec.append("\u3042"*30, dst)
    assert_same(dst, ret)
    assert_not_predicate(dst, :ascii_only?)
    assert_predicate(dst, :valid_encoding?)
  end

  def test_econv_str_append_broken
    ec = Bug::EConv.new("utf-8", "cp932")
    dst = ""
    ret = ec.append("\u3042"*30, dst)
    assert_same(dst, ret)
    assert_not_predicate(dst, :ascii_only?)
    assert_not_predicate(dst, :valid_encoding?)
  end
end
the CRuby tests, is able to run all of the YJIT benchmarks, and performs similarly to the C version (because it works the same way and largely generates the same machine code). We've even incorporated some design improvements, such as a more fine-grained constant invalidation mechanism which we expect will make a big difference in Ruby on Rails applications. Because we want to be careful, YJIT is guarded behind a configure option: ```shell ./configure --enable-yjit # Build YJIT in release mode ./configure --enable-yjit=dev # Build YJIT in dev/debug mode ``` By default, YJIT does not get compiled and cargo/rustc is not required. If YJIT is built in dev mode, then `cargo` is used to fetch development dependencies, but when building in release, `cargo` is not required, only `rustc`. At the moment YJIT requires Rust 1.60.0 or newer. The YJIT command-line options remain mostly unchanged, and more details about the build process are documented in `doc/yjit/yjit.md`. The CI tests have been updated and do not take any more resources than before. The development history of the Rust port is available at the following commit for interested parties: https://github.com/Shopify/ruby/commit/1fd9573d8b4b65219f1c2407f30a0a60e537f8be Our hope is that Rust YJIT will be compiled and included as a part of system packages and compiled binaries of the Ruby 3.2 release. We do not anticipate any major problems as Rust is well supported on every platform which YJIT supports, but to make sure that this process works smoothly, we would like to reach out to those who take care of building systems packages before the 3.2 release is shipped and resolve any issues that may come up. [issue]: https://bugs.ruby-lang.org/issues/18481 Co-authored-by: Maxime Chevalier-Boisvert <[email protected]> Co-authored-by: Noah Gibbs <[email protected]> Co-authored-by: Kevin Newton <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/5826