From 6b1c179135e7b67dd733b64447c75e8a1174d5c5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@fb.com>
Date: Sun, 22 Sep 2013 21:47:31 -0700
Subject: [PATCH] tests: ensure neither \s nor \S matches an invalid
 multibyte character

* tests/backslash-S-vs-invalid-multitype: New file.
Prompted by the bug report from Roman at
http://savannah.gnu.org/bugs/?40009
* tests/Makefile.am (TESTS): Add it.
---
 tests/Makefile.am                      |  1 +
 tests/backslash-s-vs-invalid-multitype | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100755 tests/backslash-s-vs-invalid-multitype

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 760f793..a64a2d2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -36,6 +36,7 @@ TESTS =						\
   backref					\
   backref-multibyte-slow			\
   backref-word					\
+  backslash-s-vs-invalid-multitype		\
   big-hole					\
   big-match					\
   bogus-wctob					\
diff --git a/tests/backslash-s-vs-invalid-multitype b/tests/backslash-s-vs-invalid-multitype
new file mode 100755
index 0000000..bf1861a
--- /dev/null
+++ b/tests/backslash-s-vs-invalid-multitype
@@ -0,0 +1,26 @@
+#! /bin/sh
+# Ensure that neither \s nor \S matches an invalid multibyte character.
+#
+# Copyright (C) 2013 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../src
+
+require_en_utf8_locale_
+
+LC_ALL=en_US.UTF-8
+export LC_ALL
+
+printf '\x82\n' > in || framework_failure_
+
+fail=0
+grep '^\S$' in > out-S && fail=1
+compare /dev/null out-S || exit=1
+
+grep '^\s$' in > out-s && fail=1
+compare /dev/null out-s || exit=1
+
+Exit $fail
--
1.8.4.299.gb3e7d24
