compiler/tests/PPCMergingVisitorTest.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 02 Jul 2018 08:46:03 +0200
changeset 557 5ddba1e78795
parent 524 f6f68d32de73
permissions -rw-r--r--
Tagged Smalltalk/X 8.0.0

"{ Package: 'stx:goodies/petitparser/compiler/tests' }"

"{ NameSpace: Smalltalk }"

TestCase subclass:#PPCMergingVisitorTest
	instanceVariableNames:'node result visitor node1 node2'
	classVariableNames:''
	poolDictionaries:''
	category:'PetitCompiler-Tests-Visitors'
!


!PPCMergingVisitorTest methodsFor:'as yet unclassified'!

nilNode
    ^ PPCNilNode new
!

setUp
    visitor := PPCMergingVisitor new
!

testNilNode
    node1 := self nilNode.
    node2 := self nilNode.
    
    node := PPCSequenceNode new
        children: { node1 . node2 }.
        
    self assert: (node children first == node children second) not.
    node := visitor visit: node.
    self assert: (node children first == node children second).
!

testNilNode2
    node1 := self nilNode
        name: #foo;
        yourself.
    node2 := self nilNode
        name: #bar;
        yourself.
    
    node := PPCSequenceNode new
        children: { node1 . node2 }.
        
    self assert: (node children first == node children second) not.
    node := visitor visit: node.
    self assert: (node children first == node children second) not.
! !

!PPCMergingVisitorTest class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !