The Inbox: Tests.quasiquote-eem.188.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tests.quasiquote-eem.188.mcz

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

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

Name: Tests.quasiquote-eem.188
Author: eem
Time: 5 February 2013, 9:54:12.842 pm
UUID: c6a111d6-4f3f-4810-9ed3-cb8aa57a0a1c
Ancestors: Tests-fbs.187

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

=============== Diff against Tests-fbs.187 ===============

Item was added:
+ TestCase subclass: #QuasiQuoteTest
+ instanceVariableNames: 'foo bar baz'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Tests-Compiler'!

Item was added:
+ ----- Method: QuasiQuoteTest>>evaluate: (in category 'private') -----
+ evaluate: aString
+ ^self class newCompiler evaluate: aString for: self logged: false !

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

Item was added:
+ ----- Method: QuasiQuoteTest>>testErrors (in category 'tests') -----
+ testErrors
+ self should: [self evaluate: '`hello']
+ raise: SyntaxErrorNotification, Error
+ withExceptionDo: [:ex| self assert: ex errorMessage = 'back quote expected'].
+ self should: [self evaluate: '`[nil][true][false[1][$1][#(one)]`']
+ raise: SyntaxErrorNotification, Error
+ withExceptionDo: [:ex| self assert: ex errorMessage = 'Period or right bracket expected'].
+ self shouldnt: [self evaluate: '`[nil. true. false]`']
+ raise: SyntaxErrorNotification, Error!

Item was added:
+ ----- Method: QuasiQuoteTest>>testLiterals (in category 'tests') -----
+ testLiterals
+ self assert: (self evaluate: '`[nil][true][false][1][$1][#(one)]`') equals: 'niltruefalse11#(#one)'!

Item was added:
+ ----- Method: QuasiQuoteTest>>testMessageExpressions (in category 'tests') -----
+ testMessageExpressions
+ self assert: (self evaluate: '`[self class name]`') equals: self class name.
+ self assert: (self evaluate: '`hello [1@2]`') equals: 'hello ', (1@2) asString.!

Item was added:
+ ----- Method: QuasiQuoteTest>>testNonLocalReturns (in category 'tests') -----
+ testNonLocalReturns
+ self assert: (self evaluate: '`[^#nlr]`') equals: #nlr!

Item was added:
+ ----- Method: QuasiQuoteTest>>testNullStrings (in category 'tests') -----
+ testNullStrings
+ self assert: (self evaluate: '``') equals: ''.
+ self assert: (self evaluate: '`[]`') equals: 'nil'.
+ self assert: (self evaluate: '`[][]`') equals: 'nilnil'!

Item was added:
+ ----- Method: QuasiQuoteTest>>testScopeAccess (in category 'tests') -----
+ testScopeAccess
+ foo := 'Foo'.
+ bar := 'Bar'.
+ baz := 'Baz'.
+ self assert: (self evaluate: '`[foo][bar][baz]`') equals: 'FooBarBaz'.
+ self assert: (self evaluate: '`foo[foo]bar[bar]baz[baz]`') equals: 'fooFoobarBarbazBaz'.
+
+ self assert: (self evaluate: '[:a :b :c| `[a][b][c]`] value: foo value: bar value: baz') equals: 'FooBarBaz'.
+ self assert: (self evaluate: '[:a :b :c| `foo[a]bar[b]baz[c]`] value: foo value: bar value: baz') equals: 'fooFoobarBarbazBaz'!

Item was added:
+ ----- Method: QuasiQuoteTest>>testSimpleString (in category 'tests') -----
+ testSimpleString
+ self assert: { 'hello world!!' } concatenateQuasiQuote equals: 'hello world!!'.
+ self shouldnt: [Parser new parse: '`hello world!!`' readStream class: nil class noPattern: true notifying: nil ifFail: [Error signal]]
+ raise: SyntaxErrorNotification, Error.
+ self shouldnt: [self evaluate: '`hello world!!`']
+ raise: SyntaxErrorNotification, Error.
+ self assert: (self evaluate: '`hello world!!`') equals: 'hello world!!'.
+
+ self assert: { 'hello '. #cruel. ' world!!' } concatenateQuasiQuote equals: 'hello cruel world!!'.
+ self shouldnt: [Parser new parse: '`hello [#cruel] world!!`' readStream class: nil class noPattern: true notifying: nil ifFail: [Error signal]]
+ raise: SyntaxErrorNotification, Error.
+ self shouldnt: [self evaluate: '`hello [#cruel] world!!`']
+ raise: SyntaxErrorNotification, Error.
+ self assert: (self evaluate: '`hello [#cruel] world!!`') equals: 'hello cruel world!!'.
+
+ self assert: (self evaluate: '`''hello world!!''`') equals: '''hello world!!'''.!