Skip to content

Commit

Permalink
Update RULE_4_2_A_A to handle C++20 spaceship operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Farigh committed Oct 2, 2023
1 parent f2da4bf commit c8e7b64
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions rules/RULE_4_2_A_A_space_around_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
'RSHIFTEQUAL',
'ANDEQUAL',
'XOREQUAL',
'OREQUAL'

'OREQUAL',
'SPACESHIP'
)

nextoperator = (
Expand Down Expand Up @@ -248,3 +248,31 @@ def test19(self):
""")
self.ExpectSuccess(__name__)

def testSpaceshipOperatorOK(self):
self.Analyze("test/thisFile.c",
"""
const bool isEq = std::is_eq(a <=> b);
""")
self.ExpectSuccess(__name__)

def testSpaceshipOperatorKOLeft(self):
self.Analyze("test/thisFile.c",
"""
const bool isEq = std::is_eq(a<=> b);
""")
self.ExpectError(__name__)

def testSpaceshipOperatorKORight(self):
self.Analyze("test/thisFile.c",
"""
const bool isEq = std::is_eq(a <=>b);
""")
self.ExpectError(__name__)

def testSpaceshipOperatorKOBoth(self):
self.Analyze("test/thisFile.c",
"""
const bool isEq = std::is_eq(a<=>b);
""")
self.ExpectError(__name__)

0 comments on commit c8e7b64

Please sign in to comment.