SmallSense__SmalltalkInferencerTests.st
author convert-repo
Wed, 11 Dec 2019 04:28:36 +0000
changeset 1116 b51ace366efc
parent 883 9c644e7c1d97
permissions -rw-r--r--
update tags
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
883
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
Copyright (C) 2013-2015 Jan Vrany
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
This library is free software; you can redistribute it and/or
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
modify it under the terms of the GNU Lesser General Public
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
License as published by the Free Software Foundation; either
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
version 2.1 of the License.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
This library is distributed in the hope that it will be useful,
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
but WITHOUT ANY WARRANTY; without even the implied warranty of
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
Lesser General Public License for more details.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
You should have received a copy of the GNU Lesser General Public
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
License along with this library; if not, write to the Free Software
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
"{ Package: 'stx:goodies/smallsense' }"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ NameSpace: SmallSense }"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
Smalltalk::TestCase subclass:#SmalltalkInferencerTests
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	instanceVariableNames:'inferencer manager'
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
	classVariableNames:''
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	poolDictionaries:''
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	category:'SmallSense-Tests'
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
!
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
!SmalltalkInferencerTests class methodsFor:'documentation'!
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
copyright
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
Copyright (C) 2013-2015 Jan Vrany
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
This library is free software; you can redistribute it and/or
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
modify it under the terms of the GNU Lesser General Public
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
License as published by the Free Software Foundation; either
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
version 2.1 of the License.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
This library is distributed in the hope that it will be useful,
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
but WITHOUT ANY WARRANTY; without even the implied warranty of
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
Lesser General Public License for more details.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
You should have received a copy of the GNU Lesser General Public
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
License along with this library; if not, write to the Free Software
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
! !
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
!SmalltalkInferencerTests methodsFor:'running'!
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
setUp
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
    manager := SmallSense::Manager new.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    inferencer := SmallSense::SmalltalkInferencer new.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
    inferencer manager: manager.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
    "Created: / 21-08-2015 / 14:28:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
!
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
tearDown
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
    manager := inferencer := nil
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
    "Created: / 21-08-2015 / 14:33:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
! !
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
!SmalltalkInferencerTests methodsFor:'tests'!
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
test_self_01
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
    | tree |
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
    inferencer class: self class source: 'foo ^ self bar'.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
    tree := inferencer process.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
    self assert: tree expression receiver inferedType type isClassType.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
    self assert: tree expression receiver inferedType type klass == self class
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
    "Created: / 21-08-2015 / 16:13:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
!
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
test_self_02
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
    | tree |
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
    inferencer class: self class source: 'foo self sub'.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
    tree := inferencer process.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
    self assert: tree expression receiver inferedType type isClassType.
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
    self assert: tree expression receiver inferedType type klass == self class
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
    "Created: / 21-08-2015 / 16:13:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
! !
9c644e7c1d97 Fix in Smalltalk type info manager: do not mark classes with no source stream as errorneous.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94