f69b5b97a9f00336d61582ddc2ebbf8f721da2f8
[platform/upstream/m4.git] / checks / 127.changeword
1 dnl @ ../doc/m4.texinfo:4671: Origin of test
2 dnl @ expected status: 0
3 dnl @ extra options: 
4 dnl @ Copyright (C) 2006, 2007, 2008, 2009 Free Software
5 dnl @ Foundation, Inc.
6 dnl @ This file is free software; the Free Software Foundation
7 dnl @ gives unlimited permission to copy and/or distribute it
8 dnl @ with or without modifications, as long as this notice
9 dnl @ is preserved.
10 ifdef(`changeword', `', `errprint(` skipping: no changeword support
11 ')m4exit(`77')')dnl
12 define(`foo
13 ', `bar
14 ')
15 dnl @result{}
16 dnl This example wants to recognize changeword, dnl, and `foo\n'.
17 dnl First, we check that our regexp will match.
18 regexp(`changeword', `[cd][a-z]*\|foo[
19 ]')
20 dnl @result{}0
21 regexp(`foo
22 ', `[cd][a-z]*\|foo[
23 ]')
24 dnl @result{}0
25 regexp(`f', `[cd][a-z]*\|foo[
26 ]')
27 dnl @result{}-1
28 foo
29 dnl @result{}foo
30 changeword(`[cd][a-z]*\|foo[
31 ]')
32 dnl @result{}
33 dnl Even though `foo\n' matches, we forgot to allow `f'.
34 foo
35 dnl @result{}foo
36 changeword(`[cd][a-z]*\|fo*[
37 ]?')
38 dnl @result{}
39 dnl Now we can call `foo\n'.
40 foo
41 dnl @result{}bar