compiler/tests/PPCMergingVisitorTest.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 17 Jun 2015 17:10:54 +0100
changeset 493 0aed9c69ed48
parent 452 9f4558b3be66
child 524 f6f68d32de73
permissions -rw-r--r--
Fixed target mcz - exit Smalltalk after all packages are exported.

"{ 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'!

javaWsNode
    ^ PPCUnknownNode new
        parser: PPJavaWhitespaceParser new;
        yourself
!

nilNode
    ^ PPCNilNode new
!

setUp
    visitor := PPCMergingVisitor new
!

testJavaWS
    node1 := self javaWsNode.
    node2 := self javaWsNode.
    
    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).
!

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> $'
! !