@@ -45,15 +45,15 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
4545
4646 " `||=` is represented by a lowered if call to .nil?" in {
4747 val cpg = code("""
48- |def foo
48+ |def foo(x)
4949 | x ||= false
5050 |end
5151 |""" .stripMargin)
5252
5353 inside(cpg.method.name(" foo" ).controlStructure.l) {
5454 case ifStruct :: Nil =>
5555 ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
56- ifStruct.condition.code.l shouldBe List (" x.nil? " )
56+ ifStruct.condition.code.l shouldBe List (" !x " )
5757
5858 inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
5959 case assignmentCall :: Nil =>
@@ -70,15 +70,15 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
7070
7171 " `&&=` is represented by lowered if call to .nil?" in {
7272 val cpg = code("""
73- |def foo
73+ |def foo(x)
7474 | x &&= true
7575 |end
7676 |""" .stripMargin)
7777
7878 inside(cpg.method.name(" foo" ).controlStructure.l) {
7979 case ifStruct :: Nil =>
8080 ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
81- ifStruct.condition.code.l shouldBe List (" !x.nil? " )
81+ ifStruct.condition.code.l shouldBe List (" x " )
8282
8383 inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
8484 case assignmentCall :: Nil =>
@@ -319,7 +319,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
319319 inside(cpg.method.name(" foo" ).controlStructure.l) {
320320 case ifStruct :: Nil =>
321321 ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
322- ifStruct.condition.code.l shouldBe List (" (<tmp-0> = hash[:id]).nil? " )
322+ ifStruct.condition.code.l shouldBe List (" ! hash[:id]" )
323323
324324 inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
325325 case assignmentCall :: Nil =>
@@ -363,7 +363,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
363363 inside(cpg.method.name(" foo" ).controlStructure.l) {
364364 case ifStruct :: Nil =>
365365 ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
366- ifStruct.condition.code.l shouldBe List (" ! hash[:id].nil? " )
366+ ifStruct.condition.code.l shouldBe List (" hash[:id]" )
367367
368368 inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
369369 case assignmentCall :: Nil =>
@@ -408,7 +408,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
408408 inside(cpg.method.name(" foo" ).controlStructure.l) {
409409 case ifStruct :: Nil =>
410410 ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
411- ifStruct.condition.code.l shouldBe List (" (<tmp-0> = A.B).nil? " )
411+ ifStruct.condition.code.l shouldBe List (" ! A.B" )
412412
413413 inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
414414 case assignmentCall :: Nil =>
@@ -436,7 +436,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
436436 inside(cpg.method.name(" foo" ).controlStructure.l) {
437437 case ifStruct :: Nil =>
438438 ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
439- ifStruct.condition.code.l shouldBe List (" ! A.B.nil? " )
439+ ifStruct.condition.code.l shouldBe List (" A.B" )
440440
441441 inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
442442 case assignmentCall :: Nil =>
0 commit comments