Il 10/02/2013 20:07, Holger Hans Peter Freyther ha scritto: > From: Holger Hans Peter Freyther <[email protected]> > > The species of the ConcatenatedStream is Array so we will need to > convert the result of reading from the stream with >>#next: to a > String first before we can trim the separators.
Should the species came from the current stream instead? Paolo > 2013-02-10 Holger Hans Peter Freyther <[email protected]> > > * RBParser.st: Change RBScanner>>#scanNumber to convert > the result to a String. > * RewriteTests.st: Add testcase for RBScanner>>#scanNumber. > * package.xml: Add the new test to the testsuite. > --- > packages/stinst/parser/ChangeLog | 7 +++++++ > packages/stinst/parser/RBParser.st | 2 +- > packages/stinst/parser/RewriteTests.st | 23 ++++++++++++++++++++++- > packages/stinst/parser/package.xml | 1 + > 4 files changed, 31 insertions(+), 2 deletions(-) > > diff --git a/packages/stinst/parser/ChangeLog > b/packages/stinst/parser/ChangeLog > index 31a5b2e..c20da6c 100644 > --- a/packages/stinst/parser/ChangeLog > +++ b/packages/stinst/parser/ChangeLog > @@ -1,3 +1,10 @@ > +2013-02-10 Holger Hans Peter Freyther <[email protected]> > + > + * RBParser.st: Change RBScanner>>#scanNumber to convert > + the result to a String. > + * RewriteTests.st: Add testcase for RBScanner>>#scanNumber. > + * package.xml: Add the new test to the testsuite. > + > 2013-02-08 Holger Hans Peter Freyther <[email protected]> > > * RBFormatter.st: Use the RBToken>>#storeOn: for writing. > diff --git a/packages/stinst/parser/RBParser.st > b/packages/stinst/parser/RBParser.st > index 6f2b1cb..258e039 100644 > --- a/packages/stinst/parser/RBParser.st > +++ b/packages/stinst/parser/RBParser.st > @@ -1328,7 +1328,7 @@ Stream subclass: RBScanner [ > > "Get the parsed source" > stream position: tokenStart - 1. > - string := (stream next: stop - start + 1) trimSeparators. > + string := (stream next: stop - start + 1) asString trimSeparators. > stream position: stop. > > ^RBNumberLiteralToken > diff --git a/packages/stinst/parser/RewriteTests.st > b/packages/stinst/parser/RewriteTests.st > index 8964b07..47132e8 100644 > --- a/packages/stinst/parser/RewriteTests.st > +++ b/packages/stinst/parser/RewriteTests.st > @@ -7,7 +7,7 @@ > > "====================================================================== > | > -| Copyright (C) 2007 Free Software Foundation, Inc. > +| Copyright (C) 2007,2013 Free Software Foundation, Inc. > | Written by Stephen Compall. > | > | This file is part of the GNU Smalltalk class library. > @@ -280,5 +280,26 @@ TestCase subclass: TestFormat [ > ] > ] > > +TestCase subclass: TestScanner [ > + <comment: 'Test aspects of the RBScanner'> > + > + testScanner [ > + | scanner num | > + scanner := RBScanner on: '3' readStream. > + num := scanner next. > + self assert: num value = 3. > + ] > + > + testScannerConcatStream [ > + | scanner num | > + "This is different to >>#testScanner by using a different kind of > stream with > + a different species." > + > + scanner := RBScanner on: (Kernel.ConcatenatedStream with: '3' > readStream). > + num := scanner next. > + self assert: num value = 3. > + ] > +] > + > ] > > diff --git a/packages/stinst/parser/package.xml > b/packages/stinst/parser/package.xml > index 47c7fb6..f997197 100644 > --- a/packages/stinst/parser/package.xml > +++ b/packages/stinst/parser/package.xml > @@ -29,6 +29,7 @@ > <namespace>STInST.Tests</namespace> > <sunit>STInST.Tests.TestStandardRewrites</sunit> > <sunit>STInST.Tests.TestFormat</sunit> > + <sunit>STInST.Tests.TestScanner</sunit> > <sunit>STInST.Tests.TestDefaultPoolResolution</sunit> > <sunit>STInST.Tests.TestClassicPoolResolution</sunit> > <filein>RewriteTests.st</filein> > _______________________________________________ help-smalltalk mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-smalltalk
