# HG changeset patch # User Claus Gittinger # Date 1530509886 -7200 # Node ID 3e129388a1a6bce319cd46abd88955b41675e1f7 # Parent d9855050be6c4115266dc491f93ea91dc9a007fb removed container diff -r d9855050be6c -r 3e129388a1a6 PPMappingTest.st --- a/PPMappingTest.st Mon Jul 02 07:38:01 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -"{ Package: 'stx:goodies/petitparser' }" - -PPAbstractParseTest subclass:#PPMappingTest - instanceVariableNames:'' - classVariableNames:'' - poolDictionaries:'' - category:'PetitTests-Tests' -! - - -!PPMappingTest methodsFor:'testing'! - -testFoldLeft2 - | parser | - parser := #any asParser star - foldLeft: [ :a :b | Array with: a with: b ]. - - self assert: parser parse: #(a) to: #a. - self assert: parser parse: #(a b) to: #(a b). - self assert: parser parse: #(a b c) to: #((a b) c). - self assert: parser parse: #(a b c d) to: #(((a b) c) d). - self assert: parser parse: #(a b c d e) to: #((((a b) c) d) e) -! - -testFoldLeft3 - | parser | - parser := #any asParser star - foldLeft: [ :a :b :c | Array with: a with: b with: c ]. - - self assert: parser parse: #(a) to: #a. - self assert: parser parse: #(a b c) to: #(a b c). - self assert: parser parse: #(a b c d e) to: #((a b c) d e) -! - -testFoldRight2 - | parser | - parser := #any asParser star - foldRight: [ :a :b | Array with: a with: b ]. - - self assert: parser parse: #(a) to: #a. - self assert: parser parse: #(a b) to: #(a b). - self assert: parser parse: #(a b c) to: #(a (b c)). - self assert: parser parse: #(a b c d) to: #(a (b (c d))). - self assert: parser parse: #(a b c d e) to: #(a (b (c (d e)))) -! - -testFoldRight3 - | parser | - parser := #any asParser star - foldRight: [ :a :b :c | Array with: a with: b with: c ]. - - self assert: parser parse: #(a) to: #a. - self assert: parser parse: #(a b c) to: #(a b c). - self assert: parser parse: #(a b c d e) to: #(a b (c d e)) -! - -testMap1 - | parser | - parser := #any asParser - map: [ :a | Array with: a ]. - - self assert: parser parse: #(a) to: #(a) -! - -testMap2 - | parser | - parser := (#any asParser , #any asParser) - map: [ :a :b | Array with: b with: a ]. - - self assert: parser parse: #(a b) to: #(b a) -! - -testMap3 - | parser | - parser := (#any asParser , #any asParser , #any asParser) - map: [ :a :b :c | Array with: c with: b with: a ]. - - self assert: parser parse: #(a b c) to: #(c b a) -! ! - -!PPMappingTest class methodsFor:'documentation'! - -version - ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPMappingTest.st,v 1.3 2012-05-04 22:03:40 vrany Exp $' -! - -version_CVS - ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPMappingTest.st,v 1.3 2012-05-04 22:03:40 vrany Exp $' -! - -version_SVN - ^ '§Id: PPMappingTest.st 4 2010-12-18 17:02:23Z kursjan §' -! !