[squeak-dev] The Inbox: Tests.quasiquote-eem.189.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Feb 6 17:35:14 UTC 2013


A new version of Tests was added to project The Inbox:
http://source.squeak.org/inbox/Tests.quasiquote-eem.189.mcz

==================== Summary ====================

Name: Tests.quasiquote-eem.189
Author: eem
Time: 6 February 2013, 9:34:54.456 am
UUID: bab75eb5-564e-49ef-bc98-58a00de60cb4
Ancestors: Tests.quasiquote-eem.188

Tests for the quasi-quote implemented by Compiler.quasiquote-eem.249.

Tests new version that uses $ for escaping $ ` and [.

=============== Diff against Tests.quasiquote-eem.188 ===============

Item was changed:
  ----- Method: QuasiQuoteTest>>testDecompilation (in category 'tests') -----
  testDecompilation
+ 	self assert: (self evaluate: '`[thisContext method decompile]`') asString
- 	self assert: (self evaluate: '`[thisContext method decompile]`')
  						equals: 'DoIt\	^ `[thisContext method decompile]`' withCRs.
+ 	self assert: (self evaluate: '`hello [thisContext method decompile] world!!`') asString
- 	self assert: (self evaluate: '`hello [thisContext method decompile] world!!`')
  						equals: 'hello DoIt\	^ `hello [thisContext method decompile] world!!` world!!' withCRs.
+ 	self assert: (self evaluate: '| s | `hello [s := thisContext method decompile asString. ''yo''] world!!`. s') asString
+ 						equals: 'DoIt\	| t1 |\	`hello [t1 := thisContext method decompile asString.\	''yo''] world!!`.\	^ t1' withCRs.
+ 	self assert: (self evaluate: '`$$$`$[`. thisContext method decompile') asString
+ 						equals: 'DoIt\	`$$$`$[`.\	^ thisContext method decompile' withCRs!
- 	self assert: (self evaluate: '| s | `hello [s := thisContext method decompile asString. ''yo''] world!!`. s')
- 						equals: 'DoIt\	| t1 |\	`hello [t1 := thisContext method decompile asString.\	''yo''] world!!`.\	^ t1' withCRs!

Item was added:
+ ----- Method: QuasiQuoteTest>>testEscapes (in category 'tests') -----
+ testEscapes
+ 	self assert: (self evaluate: '`$$$`$[`') equals: '$`['.
+ 	self assert: (self evaluate: '`$a$1 $!!$@$#$%$^$&$*$($)$_$-$+$=${$}$:$;$"$''$<$>$,$.$?$/`')
+ 						equals: '$a$1 $!!$@$#$%$^$&$*$($)$_$-$+$=${$}$:$;$"$''$<$>$,$.$?$/'.
+ 
+ 	"no need to escape \ in \n"
+ 	self assert: (self evaluate: '`printf("hello world!!\n");`')
+ 						equals: 'printf("hello world!!\n");'.
+ 	"no need to escape or double ' in '!!'"
+ 	self assert: (self evaluate: '`printf("%s %s %c\n", "hello", "world", ''!!'');`')
+ 						equals: 'printf("%s %s %c\n", "hello", "world", ''!!'');'.
+ 
+ 	"no need to escape $ unless it is followed by $, ` or ["
+ 	self assert: (self evaluate: '`when (/^\d+$/ && $_ < 75) { $1; $foo }`')
+ 						equals: 'when (/^\d+$/ && $_ < 75) { $1; $foo }'.
+ 
+ 	self assert: (self evaluate: '`alert(''$'' + 3 + 4);   // displays $34, but $7 may have been expected`')
+ 						equals: 'alert(''$'' + 3 + 4);   // displays $34, but $7 may have been expected'.!



More information about the Squeak-dev mailing list