xref: /PHP-8.3/Zend/tests/match/043.phpt (revision 05ef6334)
1--TEST--
2Match expression error messages
3--FILE--
4<?php
5
6class Beep {}
7
8function test(mixed $var) {
9    try {
10        match($var) {};
11    } catch (UnhandledMatchError $e) {
12        print $e->getMessage() . PHP_EOL;
13    }
14}
15
16test(null);
17test(1);
18test(5.5);
19test(5.0);
20test("foo");
21test(true);
22test(false);
23test([1, 2, 3]);
24test(new Beep());
25// Testing long strings.
26test(str_repeat('e', 100));
27test(str_repeat("e\n", 100));
28?>
29--EXPECT--
30Unhandled match case NULL
31Unhandled match case 1
32Unhandled match case 5.5
33Unhandled match case 5.0
34Unhandled match case 'foo'
35Unhandled match case true
36Unhandled match case false
37Unhandled match case of type array
38Unhandled match case of type Beep
39Unhandled match case 'eeeeeeeeeeeeeee...'
40Unhandled match case 'e\ne\ne\ne\ne\ne\ne\ne...'
41