Skip to content

Commit

Permalink
Fix for #1420: add === and !== to swap operands quick assist
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Nov 26, 2022
1 parent e243506 commit 7f8f14a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2021 the original author or authors.
* Copyright 2009-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -577,6 +577,21 @@ final class QuickAssistTests extends QuickFixTestSuite {
'&&', new SwapLeftAndRightOperandsProposal())
}

@Test
void testSwapOperands9() {
assumeTrue(isParrotParser())

assertConversion(
'g || a === v',
'g || v === a',
'===', new SwapLeftAndRightOperandsProposal())

assertConversion(
'g || a !== v',
'g || v !== a',
'!==', new SwapLeftAndRightOperandsProposal())
}

@Test
void testSplitAssignment1() {
assertConversion(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2009-2017 the original author or authors.
* Copyright 2009-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -62,6 +62,8 @@ public int getRelevance() {
case Types.COMPARE_TO:
case Types.COMPARE_EQUAL:
case Types.COMPARE_NOT_EQUAL:
case Types.COMPARE_IDENTICAL:
case Types.COMPARE_NOT_IDENTICAL:
case Types.COMPARE_LESS_THAN:
case Types.COMPARE_LESS_THAN_EQUAL:
case Types.COMPARE_GREATER_THAN:
Expand Down

0 comments on commit 7f8f14a

Please sign in to comment.