compiler/TSourceReaderTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 Sep 2015 03:51:15 +0100
changeset 16 17a2d1d9f205
parent 8 eec72263ed75
permissions -rw-r--r--
Added standalone Tea compiler - teak It allows for compilation of .tea files from the command line.

"
    Copyright (C) 2015-now Jan Vrany

    This code is not an open-source (yet). You may use this code
    for your own experiments and projects, given that:

    * all modification to the code will be sent to the
      original author for inclusion in future releases
    * this is not used in any commercial software

    This license is provisional and may (will) change in
    a future.
"
"{ Package: 'jv:tea/compiler' }"

"{ NameSpace: Smalltalk }"

TestCase subclass:#TSourceReaderTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Languages-Tea-Compiler-Model-Tests'
!

!TSourceReaderTests class methodsFor:'documentation'!

copyright
"
    Copyright (C) 2015-now Jan Vrany

    This code is not an open-source (yet). You may use this code
    for your own experiments and projects, given that:

    * all modification to the code will be sent to the
      original author for inclusion in future releases
    * this is not used in any commercial software

    This license is provisional and may (will) change in
    a future.
"
! !

!TSourceReaderTests methodsFor:'tests'!

test_01
    | unit |

    unit := (TSourceReader read:'
tObject subclass: #tMachineInteger
    category: ''tKernel''
').
    self assert: unit classes size == 1.
    self assert: unit classes anElement isClass.
    self assert: (unit classes anElement superclassName =  'tObject').
    self assert: (unit classes anElement name ='tMachineInteger').
    self assert: (unit classes anElement category ='tKernel').

    "Created: / 31-08-2015 / 15:48:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 13-09-2015 / 09:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

test_02
    | unit |

    unit := TSourceReader read:'
tObject subclass: #tMachineInteger
    category: ''tKernel''     
!!

!!tMachineInteger class methodsFor: ''tests''!!
foo <^ tMachineInteger>
    ^ 1
'.
    self assert: unit classes size == 1.
    self assert: unit classes anElement isClass.
    self assert: (unit classes anElement theMetaclass methods size == 1).
    self assert: (unit classes anElement theMetaclass methods anElement className ='tMachineInteger class').
    self assert: (unit classes anElement theMetaclass methods anElement category ='tests').

    "Created: / 31-08-2015 / 16:34:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 14-09-2015 / 06:24:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !