#QUALITY by exept
class: RegressionTests::StringTests
added:
#test82d_expanding
#test82e_expandingSpecialSequences
changed: #test60b_hash
--- a/RegressionTests__StringTests.st Mon Aug 12 11:33:28 2019 +0200
+++ b/RegressionTests__StringTests.st Mon Aug 12 11:46:52 2019 +0200
@@ -1475,22 +1475,28 @@
!
test60b_hash
+ "verifies that symbols hash the same as string, u16string and u32string"
+
| tester |
"/ self skip:'takes long'.
tester := [:s|
- |sHash u16Hash u32Hash|
+ |sHash u8Hash u16Hash u32Hash|
sHash := s hash.
+ u8Hash := s asString hash.
u16Hash := s asUnicode16String hash.
u32Hash := s asUnicode32String hash.
+ self assert: sHash == u8Hash
+ description: ('Symbol and String hashes differ on "%1" (%2)'
+ bindWith:s with:s class name).
self assert: sHash == u16Hash
- description: ('String and Unicode16String hashes differ on "%1" (%2)'
+ description: ('Symbol and Unicode16String hashes differ on "%1" (%2)'
bindWith:s with:s class name).
self assert: sHash == u32Hash
- description: ('String and Unicode32String hashes differ on "%1" (%2)'
+ description: ('Symbol and Unicode32String hashes differ on "%1" (%2)'
bindWith:s with:s class name)
].
@@ -1980,6 +1986,66 @@
self assert:(rslt = '%1 AAAa %(1) BBBb').
!
+test82d_expanding
+ "what happens with missing keys:"
+
+ | rslt |
+
+ rslt := '%1-%2-%3'
+ expandPlaceholders:$%
+ with:{10 . 20 }
+ ignoreNumericEscapes:false
+ ignoreNonNumericEscapes:false
+ ignoreSpecialEscapes:false
+ requireParentheses:false.
+ self assert:(rslt = '10-20-').
+
+ "/ stupid backward compatibiliy!!
+ rslt := '%a-%b-%c'
+ expandPlaceholders:$%
+ with:(Dictionary withKeys:#('a' 'b') andValues:#(10 20 ))
+ ignoreNumericEscapes:false
+ ignoreNonNumericEscapes:false
+ ignoreSpecialEscapes:false
+ requireParentheses:false.
+ self assert:(rslt = '10-20-%c').
+
+ "/ stupid backward compatibiliy!!
+ rslt := '%(a)-%(b)-%(c)'
+ expandPlaceholders:$%
+ with:(Dictionary withKeys:#('a' 'b') andValues:#(10 20 ))
+ ignoreNumericEscapes:false
+ ignoreNonNumericEscapes:false
+ ignoreSpecialEscapes:false
+ requireParentheses:false.
+ self assert:(rslt = '10-20-').
+!
+
+test82e_expandingSpecialSequences
+ | rslt |
+
+ rslt := 'abc%<tab>def'
+ expandPlaceholders:$%
+ with:nil
+ ignoreNumericEscapes:false
+ ignoreNonNumericEscapes:false
+ ignoreSpecialEscapes:false
+ requireParentheses:false.
+ self assert:(rslt = ('abc',Character tab,'def')).
+
+ rslt := 'abc%<crlf>def'
+ expandPlaceholders:$%
+ with:nil
+ ignoreNumericEscapes:false
+ ignoreNonNumericEscapes:false
+ ignoreSpecialEscapes:false
+ requireParentheses:false.
+ self assert:(rslt = ('abc',String crlf,'def')).
+
+ rslt := 'abc%<crlf>def' with:nil.
+ self assert:(rslt = ('abc',String crlf,'def')).
+!
+
test83_padding
| rslt |