@@ -45,15 +45,15 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
45
45
46
46
" `||=` is represented by a lowered if call to .nil?" in {
47
47
val cpg = code("""
48
- |def foo
48
+ |def foo(x)
49
49
| x ||= false
50
50
|end
51
51
|""" .stripMargin)
52
52
53
53
inside(cpg.method.name(" foo" ).controlStructure.l) {
54
54
case ifStruct :: Nil =>
55
55
ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
56
- ifStruct.condition.code.l shouldBe List (" x.nil? " )
56
+ ifStruct.condition.code.l shouldBe List (" !x " )
57
57
58
58
inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
59
59
case assignmentCall :: Nil =>
@@ -70,15 +70,15 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
70
70
71
71
" `&&=` is represented by lowered if call to .nil?" in {
72
72
val cpg = code("""
73
- |def foo
73
+ |def foo(x)
74
74
| x &&= true
75
75
|end
76
76
|""" .stripMargin)
77
77
78
78
inside(cpg.method.name(" foo" ).controlStructure.l) {
79
79
case ifStruct :: Nil =>
80
80
ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
81
- ifStruct.condition.code.l shouldBe List (" !x.nil? " )
81
+ ifStruct.condition.code.l shouldBe List (" x " )
82
82
83
83
inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
84
84
case assignmentCall :: Nil =>
@@ -319,7 +319,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
319
319
inside(cpg.method.name(" foo" ).controlStructure.l) {
320
320
case ifStruct :: Nil =>
321
321
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]" )
323
323
324
324
inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
325
325
case assignmentCall :: Nil =>
@@ -363,7 +363,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
363
363
inside(cpg.method.name(" foo" ).controlStructure.l) {
364
364
case ifStruct :: Nil =>
365
365
ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
366
- ifStruct.condition.code.l shouldBe List (" ! hash[:id].nil? " )
366
+ ifStruct.condition.code.l shouldBe List (" hash[:id]" )
367
367
368
368
inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
369
369
case assignmentCall :: Nil =>
@@ -408,7 +408,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
408
408
inside(cpg.method.name(" foo" ).controlStructure.l) {
409
409
case ifStruct :: Nil =>
410
410
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" )
412
412
413
413
inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
414
414
case assignmentCall :: Nil =>
@@ -436,7 +436,7 @@ class SingleAssignmentTests extends RubyCode2CpgFixture {
436
436
inside(cpg.method.name(" foo" ).controlStructure.l) {
437
437
case ifStruct :: Nil =>
438
438
ifStruct.controlStructureType shouldBe ControlStructureTypes .IF
439
- ifStruct.condition.code.l shouldBe List (" ! A.B.nil? " )
439
+ ifStruct.condition.code.l shouldBe List (" A.B" )
440
440
441
441
inside(ifStruct.whenTrue.ast.isCall.name(Operators .assignment).l) {
442
442
case assignmentCall :: Nil =>
0 commit comments