Janis Danisevskis | 112c9cc | 2016-03-31 13:35:25 +0100 | [diff] [blame] | 1 | # This is a specialized test for checking, when PCRE2 is compiled with the |
| 2 | # EBCDIC option but in an ASCII environment, that newline, white space, and \c |
| 3 | # functionality is working. It catches cases where explicit values such as 0x0a |
| 4 | # have been used instead of names like CHAR_LF. Needless to say, it is not a |
| 5 | # genuine EBCDIC test! In patterns, alphabetic characters that follow a |
| 6 | # backslash must be in EBCDIC code. In data, NL, NEL, LF, ESC, and DEL must be |
| 7 | # in EBCDIC, but can of course be specified as escapes. |
| 8 | |
| 9 | # Test default newline and variations |
| 10 | |
| 11 | /^A/m |
| 12 | ABC |
| 13 | 12\x15ABC |
| 14 | |
| 15 | /^A/m,newline=any |
| 16 | 12\x15ABC |
| 17 | 12\x0dABC |
| 18 | 12\x0d\x15ABC |
| 19 | 12\x25ABC |
| 20 | |
| 21 | /^A/m,newline=anycrlf |
| 22 | 12\x15ABC |
| 23 | 12\x0dABC |
| 24 | 12\x0d\x15ABC |
| 25 | ** Fail |
| 26 | 12\x25ABC |
| 27 | |
| 28 | # Test \h |
| 29 | |
| 30 | /^A\/ |
| 31 | A B |
| 32 | A\x41B |
| 33 | |
| 34 | # Test \H |
| 35 | |
| 36 | /^A\È/ |
| 37 | AB |
| 38 | A\x42B |
| 39 | ** Fail |
| 40 | A B |
| 41 | A\x41B |
| 42 | |
| 43 | # Test \R |
| 44 | |
| 45 | /^A\Ù/ |
| 46 | A\x15B |
| 47 | A\x0dB |
| 48 | A\x25B |
| 49 | A\x0bB |
| 50 | A\x0cB |
| 51 | ** Fail |
| 52 | A B |
| 53 | |
| 54 | # Test \v |
| 55 | |
| 56 | /^A\¥/ |
| 57 | A\x15B |
| 58 | A\x0dB |
| 59 | A\x25B |
| 60 | A\x0bB |
| 61 | A\x0cB |
| 62 | ** Fail |
| 63 | A B |
| 64 | |
| 65 | # Test \V |
| 66 | |
| 67 | /^A\å/ |
| 68 | A B |
| 69 | ** Fail |
| 70 | A\x15B |
| 71 | A\x0dB |
| 72 | A\x25B |
| 73 | A\x0bB |
| 74 | A\x0cB |
| 75 | |
| 76 | # For repeated items, use an atomic group so that the output is the same |
| 77 | # for DFA matching (otherwise it may show multiple matches). |
| 78 | |
| 79 | # Test \h+ |
| 80 | |
| 81 | /^A(?>\+)/ |
| 82 | A B |
| 83 | |
| 84 | # Test \H+ |
| 85 | |
| 86 | /^A(?>\È+)/ |
| 87 | AB |
| 88 | ** Fail |
| 89 | A B |
| 90 | |
| 91 | # Test \R+ |
| 92 | |
| 93 | /^A(?>\Ù+)/ |
| 94 | A\x15B |
| 95 | A\x0dB |
| 96 | A\x25B |
| 97 | A\x0bB |
| 98 | A\x0cB |
| 99 | ** Fail |
| 100 | A B |
| 101 | |
| 102 | # Test \v+ |
| 103 | |
| 104 | /^A(?>\¥+)/ |
| 105 | A\x15B |
| 106 | A\x0dB |
| 107 | A\x25B |
| 108 | A\x0bB |
| 109 | A\x0cB |
| 110 | ** Fail |
| 111 | A B |
| 112 | |
| 113 | # Test \V+ |
| 114 | |
| 115 | /^A(?>\å+)/ |
| 116 | A B |
| 117 | ** Fail |
| 118 | A\x15B |
| 119 | A\x0dB |
| 120 | A\x25B |
| 121 | A\x0bB |
| 122 | A\x0cB |
| 123 | |
| 124 | # Test \c functionality |
| 125 | |
| 126 | /\@\A\b\C\d\E\f\G\h\I\J\K\l\m\N\O\p\q\r\S\T\u\V\W\X\y\Z/ |
| 127 | \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f |
| 128 | |
| 129 | /\[\\\]\^\_/ |
| 130 | \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f |
| 131 | |
| 132 | /\?/ |
| 133 | A\xffB |
| 134 | |
| 135 | /\&/ |
| 136 | |
| 137 | # End |