From 2e6050bf546e53c74cb81bf71c4c9ba4e3d1e488 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 23 Mar 2013 14:00:29 -0700 Subject: [PATCH] splitting: Support SBUF" " with split-lines. Fixes #575. Thanks @mrjbq7 for the patch. --- core/splitting/splitting-tests.factor | 12 ++++++++++++ core/splitting/splitting.factor | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/splitting/splitting-tests.factor b/core/splitting/splitting-tests.factor index 5cda813c7b..7cb0df9ba0 100644 --- a/core/splitting/splitting-tests.factor +++ b/core/splitting/splitting-tests.factor @@ -58,6 +58,18 @@ unit-test [ { "hello" "hi" } ] [ "hello\rhi" string-lines ] unit-test [ { "hello" "hi" } ] [ "hello\r\nhi" string-lines ] unit-test +[ { SBUF" " } ] [ SBUF" " string-lines ] unit-test +[ { SBUF" " SBUF" " } ] [ SBUF" \n" string-lines ] unit-test +[ { SBUF" " SBUF" " } ] [ SBUF" \r" string-lines ] unit-test +[ { SBUF" " SBUF" " } ] [ SBUF" \r\n" string-lines ] unit-test +[ { SBUF" hello" } ] [ SBUF" hello" string-lines ] unit-test +[ { SBUF" hello" SBUF" " } ] [ SBUF" hello\n" string-lines ] unit-test +[ { SBUF" hello" SBUF" " } ] [ SBUF" hello\r" string-lines ] unit-test +[ { SBUF" hello" SBUF" " } ] [ SBUF" hello\r\n" string-lines ] unit-test +[ { SBUF" hello" SBUF" hi" } ] [ SBUF" hello\nhi" string-lines ] unit-test +[ { SBUF" hello" SBUF" hi" } ] [ SBUF" hello\rhi" string-lines ] unit-test +[ { SBUF" hello" SBUF" hi" } ] [ SBUF" hello\r\nhi" string-lines ] unit-test + [ { "hey" "world" "what's" "happening" } ] [ "heyAworldBwhat'sChappening" [ LETTER? ] split-when ] unit-test diff --git a/core/splitting/splitting.factor b/core/splitting/splitting.factor index d2348b9e6b..16944c3120 100644 --- a/core/splitting/splitting.factor +++ b/core/splitting/splitting.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel make math sequences strings ; +USING: arrays kernel make math sequences strings sbufs ; IN: splitting