Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.313.mcz ==================== Summary ==================== Name: Tests-eem.313 Author: eem Time: 19 March 2015, 11:36:45.654 am UUID: 73f5d743-97d9-47a2-b36e-7ddd7b30d136 Ancestors: Tests-nice.312 Provide a test to check that the tempsMark is positioned correctly in non-interactive parsing. Used for the new toggle break on entry code. =============== Diff against Tests-nice.312 =============== Item was added: + TestCase subclass: #ParserEditingTest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Tests-Compiler'! Item was added: + ----- Method: ParserEditingTest>>parse:into: (in category 'support') ----- + parse: aString into: aTrinaryBlock + | parser code | + parser := self class newParser. + code := aString withCRs. + ^aTrinaryBlock + value: (parser parse: code class: self class; yourself) + value: parser tempsMark + value: code! Item was added: + ----- Method: ParserEditingTest>>testTempsMarkBinary (in category 'tests') ----- + testTempsMarkBinary + self parse: '+ arg foo' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code indexOf: $f)]. + self parse: '+ arg\ foo' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code indexOf: $f)]. + self parse: '+ arg\ <pragma>\ foo' into: + [:parser :tempsMark :code| + self assert: (tempsMark = (code indexOf: $f) or: [tempsMark = (code indexOf: $<)])]. + self parse: '+ arg | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: '+ arg\ | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: '+ arg\ <pragma>\ | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: '+ arg\ | foo |\ <pragma>\ bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]! Item was added: + ----- Method: ParserEditingTest>>testTempsMarkKeyword (in category 'tests') ----- + testTempsMarkKeyword + self parse: 'key: word foo' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code indexOf: $f)]. + self parse: 'key: word\ foo' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code indexOf: $f)]. + self parse: 'key: word\ <pragma>\ foo' into: + [:parser :tempsMark :code| + self assert: (tempsMark = (code indexOf: $f) or: [tempsMark = (code indexOf: $<)])]. + self parse: 'key: word | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: 'key: word\ | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: 'key: word\ <pragma>\ | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: 'key: word\ | foo |\ <pragma>\ bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]! Item was added: + ----- Method: ParserEditingTest>>testTempsMarkUnary (in category 'tests') ----- + testTempsMarkUnary + self parse: 'unary foo' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code indexOf: $f)]. + self parse: 'unary\ foo' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code indexOf: $f)]. + self parse: 'unary\ <pragma>\ foo' into: + [:parser :tempsMark :code| + self assert: (tempsMark = (code indexOf: $f) or: [tempsMark = (code indexOf: $<)])]. + self parse: 'unary | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: 'unary\ | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: 'unary\ <pragma>\ | foo | bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]. + self parse: 'unary\ | foo |\ <pragma>\ bar' into: + [:parser :tempsMark :code| + self assert: tempsMark = (code lastIndexOf: $|)]! |
Free forum by Nabble | Edit this page |