From fd217d475d885d02e526deef644d552cdec28b13 Mon Sep 17 00:00:00 2001 From: ydah Date: Wed, 27 Nov 2024 19:31:29 +0900 Subject: [ruby/prism] Reject invalid operator after match predicate or after match required Partially fixes: #3171 https://github.com/ruby/prism/commit/d0d9699c27 --- test/prism/errors/match_predicate_after_and_with_opreator.txt | 3 +++ test/prism/errors/match_predicate_after_or_with_opreator.txt | 3 +++ test/prism/errors/match_predicate_after_rescue_with_opreator.txt | 3 +++ test/prism/errors/match_required_after_and_with_opreator.txt | 3 +++ test/prism/errors/match_required_after_or_with_opreator.txt | 3 +++ test/prism/errors/match_required_after_rescue_with_opreator.txt | 3 +++ 6 files changed, 18 insertions(+) create mode 100644 test/prism/errors/match_predicate_after_and_with_opreator.txt create mode 100644 test/prism/errors/match_predicate_after_or_with_opreator.txt create mode 100644 test/prism/errors/match_predicate_after_rescue_with_opreator.txt create mode 100644 test/prism/errors/match_required_after_and_with_opreator.txt create mode 100644 test/prism/errors/match_required_after_or_with_opreator.txt create mode 100644 test/prism/errors/match_required_after_rescue_with_opreator.txt (limited to 'test') diff --git a/test/prism/errors/match_predicate_after_and_with_opreator.txt b/test/prism/errors/match_predicate_after_and_with_opreator.txt new file mode 100644 index 0000000000..5a0c5925ea --- /dev/null +++ b/test/prism/errors/match_predicate_after_and_with_opreator.txt @@ -0,0 +1,3 @@ +1 and 2 in 3 % 4 + ^ unexpected '%', expecting end-of-input + diff --git a/test/prism/errors/match_predicate_after_or_with_opreator.txt b/test/prism/errors/match_predicate_after_or_with_opreator.txt new file mode 100644 index 0000000000..8ea69e4787 --- /dev/null +++ b/test/prism/errors/match_predicate_after_or_with_opreator.txt @@ -0,0 +1,3 @@ +1 or 2 in 3 + 4 + ^ unexpected '+', expecting end-of-input + diff --git a/test/prism/errors/match_predicate_after_rescue_with_opreator.txt b/test/prism/errors/match_predicate_after_rescue_with_opreator.txt new file mode 100644 index 0000000000..b2363a544d --- /dev/null +++ b/test/prism/errors/match_predicate_after_rescue_with_opreator.txt @@ -0,0 +1,3 @@ +1 rescue 2 in 3 << 4 + ^~ unexpected <<, expecting end-of-input + diff --git a/test/prism/errors/match_required_after_and_with_opreator.txt b/test/prism/errors/match_required_after_and_with_opreator.txt new file mode 100644 index 0000000000..eafbc1f12a --- /dev/null +++ b/test/prism/errors/match_required_after_and_with_opreator.txt @@ -0,0 +1,3 @@ +1 and 2 => 3 - 4 + ^ unexpected '-', expecting end-of-input + diff --git a/test/prism/errors/match_required_after_or_with_opreator.txt b/test/prism/errors/match_required_after_or_with_opreator.txt new file mode 100644 index 0000000000..c35f3b66e4 --- /dev/null +++ b/test/prism/errors/match_required_after_or_with_opreator.txt @@ -0,0 +1,3 @@ +1 or 2 => 3 ^ 4 + ^ unexpected '^', expecting end-of-input + diff --git a/test/prism/errors/match_required_after_rescue_with_opreator.txt b/test/prism/errors/match_required_after_rescue_with_opreator.txt new file mode 100644 index 0000000000..903e2ccc8e --- /dev/null +++ b/test/prism/errors/match_required_after_rescue_with_opreator.txt @@ -0,0 +1,3 @@ +1 rescue 2 => 3 ** 4 + ^~ unexpected '**', expecting end-of-input + -- cgit v1.2.3