dumping ground for random patches and texts
 help / color / mirror / Atom feed
* [PATCH] fstring
@ 2016-12-27  0:54 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-12-27  0:54 UTC (permalink / raw)
  To: spew

---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-12-27  0:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-27  0:54 [PATCH] fstring Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).