1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

32 commits

Author SHA1 Message Date
Andy Wingo
12b8487d5d Merge commit '0ce224594a' 2014-02-08 14:48:56 +01:00
Mark H Weaver
0ce224594a Improve handling of locales in the test suite.
* test-suite/guile-test (run-tests): Load each test file within
  (with-locale "C" ...).

* test-suite/tests/encoding-iso88591.test:
* test-suite/tests/encoding-iso88597.test:
* test-suite/tests/encoding-utf8.test:
* test-suite/tests/srfi-14.test: Remove broken code to save and restore
  the previous locale.

* test-suite/tests/bytevectors.test:
* test-suite/tests/format.test:
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-19.test:
* test-suite/tests/tree-il.test: Make sure 'setlocale' is defined before
  calling it.
2014-02-07 21:49:35 -05:00
Mark H Weaver
6dce942c46 String ports use UTF-8; ignore %default-port-encoding.
* libguile/strports.c (scm_mkstrport): Use UTF-8; ignore
  %default-port-encoding.  Rename 'str_len' and 'c_pos' to
  'num_bytes' and 'c_byte_pos'.  Interpret 'pos' argument
  as a character index instead of a byte index.

* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-6 to the
  list of core features.

* module/srfi/srfi-6.scm (open-input-string, open-output-string): Simply
  re-export these, since the core versions are now compliant.

* doc/ref/api-io.texi (String Ports): Remove text that describes
  non-compliant behavior of string ports with regard to encoding.

* doc/ref/srfi-modules.texi (SRFI-0): Add srfi-6 to the list of
  core features.
  (SRFI-6): Remove text that mentions non-compliant behavior of
  core string ports.

* module/ice-9/format.scm (format):
* module/ice-9/pretty-print.scm (truncated-print):
* module/rnrs/io/ports.scm (open-string-input-port,
  open-string-output-port):
* test-suite/test-suite/lib.scm (format-test-name):
* test-suite/tests/chars.test ("combining accent is pretty-printed",
  "combining X is pretty-printed"):
* test-suite/tests/ecmascript.test (eread, eread/1):
* test-suite/tests/rdelim.test:
* test-suite/tests/reader.test (read-string):
* test-suite/tests/regexp.test:
* test-suite/tests/srfi-105.test (read-string): Don't set
  %default-port-encoding before creating string ports.

* benchmark-suite/benchmarks/ports.bm (%latin1-port): Use
  'set-port-encoding!' to set the string port encoding.
  (%utf8/ascii-port, %utf8/wide-port, "rdelim"): Don't set
  %default-port-encoding before creating string ports.

* test-suite/tests/r6rs-ports.test ("lookahead-u8 non-ASCII"): Don't set
  %default-port-encoding before creating string ports.
  ("put-bytevector with UTF-16 string port", "put-bytevector with
  wrong-encoding string port"): Use 'set-port-encoding!' to set the
  string port encoding.

* test-suite/tests/print.test (tprint): Use 'set-port-encoding!' to set
  the string port encoding.
  ("truncated-print"): Use 'pass-if-equal'.

* test-suite/tests/ports.test ("encoding failure leads to exception",
  "%default-port-encoding is honored", "peek-char [latin-1]", "peek-char
  [utf-8]", "peek-char [utf-16]"): Remove tests.
  ("%default-port-encoding is ignored", "peek-char"): Add tests.
  ("suitable encoding [latin-1]", "suitable encoding [latin-3]",
  "wrong encoding, error", "wrong encoding, substitute",
  "wrong encoding, escape"): Use 'set-port-encoding!' to set the
  string port encoding.
  ("%default-port-encoding, wrong encoding"): Rewrite to use
  a file port instead of a string port.
2013-08-07 01:22:22 -04:00
Andy Wingo
b4fa6cc909 Merge remote-tracking branch 'origin/stable-2.0'
There is a failing test due to a scm_from_utf8_stringn bug brought out
by the iconv test that will be fixed in the next commit.

Conflicts:
	libguile/deprecated.h
	module/ice-9/deprecated.scm
2013-01-15 10:45:39 +01:00
Andy Wingo
921cd222b9 deprecate SCM_CHAR_CODE_LIMIT and char-code-limit
* libguile/__scm.h:
* libguile/deprecated.h (SCM_CHAR_CODE_LIMIT): Move declaration here
  from __scm.h.

* libguile/feature.c:
* module/ice-9/deprecated.scm (char-code-limit): Move definition here.

* test-suite/tests/regexp.test: Update to not use char-code-limit.
2013-01-10 16:01:06 +01:00
Mark H Weaver
fa980bcc0f Merge remote-tracking branch 'origin/stable-2.0'
Moved scm_i_struct_hash from struct.c to hash.c and made it static.

The port's alist is now a field of 'scm_t_port'.

Conflicts:
	libguile/arrays.c
	libguile/hash.c
	libguile/ports.c
	libguile/print.h
	libguile/read.c
2012-10-30 23:46:31 -04:00
Chris K. Jester-Young
d6e1c8bfdb In fold-matches, set regexp/notbol unless matching string start.
* module/ice-9/regex.scm (fold-matches): Set regexp/notbol if the
  starting position is nonzero.
* test-suite/tests/regexp.test (fold-matches): Check that when
  matching /^foo/ against "foofoofoofoo", only one match results.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2012-09-26 23:46:05 +02:00
Ludovic Courtès
7aa394b53c doc: Fix description of regexp/locale encoding interaction.
* doc/ref/api-regex.texi (Regexp Functions): Update paragraph that
  mentions locale encoding and strings-as-bytes.

* test-suite/tests/regexp.test ("nonascii locales")["match structures
  refer to char offsets, non-ASCII pattern"]: New test.
2012-08-27 00:09:30 +02:00
Andy Wingo
91ee7515da Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	libguile/__scm.h
	libguile/array-map.c
	libguile/procprop.c
	libguile/tags.h
	module/ice-9/deprecated.scm
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
	test-suite/standalone/test-num2integral.c
	test-suite/tests/regexp.test
2012-01-10 00:41:42 +01:00
Ludovic Courtès
211e71a184 Make sure `regexp-quote' tests use Unicode-capable string ports.
* test-suite/tests/regexp.test (with-unicode): New macro.
  ("regexp-quote"): Wrap all `regexp-quote' calls in it.  This fixes
  tests on machines where the default port encoding is US-ASCII.
2012-01-09 23:16:20 +01:00
Andy Wingo
a1a3a0dd5d regexp.test needed char-code-limit
* test-suite/tests/regexp.test (char-code-limit): Define a local version
  of this recently removed definition.  Hopefully that's the only use
  of it though!
2011-05-15 17:29:46 +02:00
Ludovic Courtès
43ecaffc2f Fix `regexp.test' when the "en_US.utf8" locale isn't available.
* test-suite/tests/regexp.test ("nonascii locales"): Move `with-locale'
  within the body of `pass-if' so that `unresolved' is caught.
2010-11-24 23:38:01 +01:00
Andy Wingo
644c5165ee fix regexp matches to refer to chars, not bytes
* libguile/regex-posix.c (fixup_multibyte_match): Fixup the match
  structure to refer to character offsets, not byte offsets. Fixes bug
  31650.

* test-suite/tests/regexp.test: Add a test.
2010-11-23 22:39:20 +01:00
Ludovic Courtès
8a954f3df5 Always run at least the ASCII regexp tests.
* test-suite/tests/regexp.test (with-ascii-or-latin1-locale): New macro.
  ("regexp-quote"): Use it instead of `with-latin1-locale'.
2010-10-08 15:25:56 +02:00
Ludovic Courtès
dec84a0a6e Try to avoid `guile-test' failures when it can't display the name of a test.
This can happen, e.g., when printing "UNRESOLVED: regexp.test: TEST-NAME",
where TEST-NAME contains characters that cannot be converted to the
encoding of the current output or error port.

* test-suite/guile-test (main): Set the conversion strategy for the
  output and error ports to `escape'.

* test-suite/tests/regexp.test (current-output-port): Likewise.
2010-03-04 11:32:51 +01:00
Ludovic Courtès
1c242b37f0 Use with-latin1-locale' in regexp.test'.
As a side effect, it fixes tests on platforms with no 8-bit locale and
where executing regexps on characters >= 128 can lead to errors such as
`cannot convert to output locale "US-ASCII": ""\x80""'.

This commit partially reverts 7583976b ("More setlocale robustness in
regexp tests").

* test-suite/tests/regexp.test (mysetlocale, set-latin-1): Remove.
  ("regexp-quote"): Use `with-latin1-locale' instead of the above
  procedures.
2010-03-04 00:47:21 +01:00
Michael Gran
d71db1f9a9 Modify regexp.test to work better with mac/darwin
* test-suite/tests/regexp.test (set-latin-1): also add .ISO8859-1 as a
  possible extension for latin-1 locales.  Use set-latin-1 exclusively
  to set the locale for tests.
2009-10-12 06:55:25 -07:00
Michael Gran
7583976b3a More setlocale robustness in regexp tests
* test-suite/tests/regexp.test (mysetlocale, set-latin-1): new functions
  (with-latin1-locale): removed
  (regexp-quote tests): try to print test names in locale but run tests
  in ISO-8859-1.
2009-09-10 21:30:11 -07:00
Michael Gran
e354d7689a Avoid prematurely ending regexp test when ISO-8859-1 locale not found
* test-suite/tests/regexp.test (with-latin1-locale): new function
  Call tests in context of with-latin1-locale
2009-09-09 08:11:21 -07:00
Michael Gran
0d05ae7c4b 8-bit locale needed for 8-bit regexp tests
Since the regex library expects 8-bit clean characters and
an 8-bit locale, tests of 8-bit characters need to occur within
the context of an 8-bit locale.

* test-suite/tests/regexp.test (regexp-quote tests): wrap them in an
  ISO-8859-1 locale
2009-09-07 19:12:40 -07:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
76ed3e877f Enclose `regexp.test' in a module.
* test-suite/tests/regexp.test: Add `define-module' clause.
2008-09-25 21:36:14 +02:00
Ludovic Courtès
c633310265 Fix handling of the FLAGS argument in `fold-matches'.
* ice-9/regex.scm (fold-matches): If FLAGS is non-null, use
  `(car flags)', not `flags'.

* test-suite/tests/regexp.test ("fold-matches"): New test prefix.

* NEWS: Update.
2008-09-25 21:07:06 +02:00
Kevin Ryde
8e1973d9ab merge from 1.8 2007-01-15 23:49:04 +00:00
Kevin Ryde
6e7d5622ee merge from 1.8 branch 2006-04-16 23:37:40 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Kevin Ryde
38923713f1 (match:string): New tests. 2004-09-28 23:53:02 +00:00
Kevin Ryde
1df6de9637 (regexp-quote): New tests. 2004-08-27 01:14:49 +00:00
Kevin Ryde
710491c564 (make-regexp): Exercise flags args validation. 2004-07-27 22:49:52 +00:00
Marius Vollmer
0a77048bfd (regexp-substitute/global): Do not test with empty regexp. Empty
regexps do not work on NetBSD.
2002-05-06 19:32:20 +00:00
Jim Blandy
f88fdc6e32 * tests/regexp.test: Check regexp-substitute/global when there are
no matches.  (Duh.)
1999-09-20 22:52:02 +00:00
Jim Blandy
3dcdcfe8c7 * tests/regexp.test: New test file. 1999-09-11 17:39:30 +00:00