RegressionTests__LiteralsInMethodTests.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 1447 2351db93aa5b
child 1500 d406a10b2965
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
     1
"{ Package: 'stx:goodies/regression' }"
616
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
TestCase subclass:#LiteralsInMethodTests
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	instanceVariableNames:''
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	poolDictionaries:''
1262
17773030b8fe class: RegressionTests::LiteralsInMethodTests
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
     9
	category:'tests-Regression-RuntimeSystem'
616
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!LiteralsInMethodTests class methodsFor:'documentation'!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
documentation
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
    documentation to be added.
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
    [author:]
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
    19
	cg
616
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
    [instance variables:]
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
    [class variables:]
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
    [see also:]
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
! !
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
!LiteralsInMethodTests methodsFor:'tested methods'!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
classCheck:arg
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
    "only a check-method"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
    (arg class == Array) ifTrue:[
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1262
diff changeset
    36
	arg yourself
616
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
    ].
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    "Created: / 08-08-2011 / 20:26:31 / cg"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
methodWithStringLiteral1
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    ^ 'abcd'
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    "Created: / 08-08-2011 / 17:14:10 / cg"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
methodWithStringLiteral2
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    ^ 'abc'
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    "Created: / 08-08-2011 / 17:14:13 / cg"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
! !
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
!LiteralsInMethodTests methodsFor:'tests'!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
test01_methodContainsLiterals
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    "old stc/compiler versions did not generate literals for inlined
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
     sends, which made problems when quick-searching for senders (which filters
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
     candidate-methods using the literal array"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    |m|
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    m := self class compiledMethodAt:#classCheck:.
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    self assert:(m literals includes:#'==').
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    self assert:(m literals includes:#'class').
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    self assert:(m literals includes:#'yourself').
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    "
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
     self run:#test01_methodContainsLiterals
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
     self new test01_methodContainsLiterals
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    "
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    "Created: / 08-08-2011 / 16:33:06 / cg"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
test02_patternStringLiteral
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
"/ for now, only bytecode contains string literals - skip this.
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
"/    |m|
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
"/
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
"/    m := self class compiledMethodAt:#methodWithStringLiteral.
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    "
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
     self run:#test01_methodContainsLiterals
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
     self new test01_methodContainsLiterals
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    "
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    "Created: / 08-08-2011 / 16:54:28 / cg"
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
! !
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
!LiteralsInMethodTests class methodsFor:'documentation'!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
version
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    ^ '$Header$'
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
!
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
version_CVS
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    ^ '$Header$'
b1c37b2c7848 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
! !
1262
17773030b8fe class: RegressionTests::LiteralsInMethodTests
Claus Gittinger <cg@exept.de>
parents: 616
diff changeset
    99