From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS30633 207.244.64.0/18 X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00, RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_ZBI,RCVD_IN_XBL,RDNS_NONE,SPF_FAIL, SPF_HELO_FAIL,TO_EQ_FM_DOM_SPF_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from 80x24.org (unknown [207.244.70.35]) by dcvr.yhbt.net (Postfix) with ESMTP id D15891FF76 for ; Tue, 27 Dec 2016 00:54:44 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] fstring Date: Tue, 27 Dec 2016 00:54:41 +0000 Message-Id: <20161227005441.11847-1-e@80x24.org> List-Id: --- string.c | 2 ++ test/ruby/test_string.rb | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/string.c b/string.c index 242ebb9f05..236058ac2e 100644 --- a/string.c +++ b/string.c @@ -10080,6 +10080,8 @@ Init_String(void) rb_define_method(rb_cString, "valid_encoding?", rb_str_valid_encoding_p, 0); rb_define_method(rb_cString, "ascii_only?", rb_str_is_ascii_only_p, 0); + rb_define_method(rb_cString, "fstring", rb_fstring, 0); + rb_fs = Qnil; rb_define_hooked_variable("$;", &rb_fs, 0, rb_fs_setter); rb_define_hooked_variable("$-F", &rb_fs, 0, rb_fs_setter); diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 4dee245462..5c880034b4 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -2539,6 +2539,11 @@ def test_chr assert_equal("\u3042", "\u3042\u3043".chr) assert_equal('', ''.chr) end + + def test_fstring + ts = 'fstring test case'.freeze + assert_same ts, ts.dup.fstring + end end class TestString2 < TestString -- EW