Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(25)

Issue 6022045: Added tests for number types. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years ago by Alok Priyadarshi
Modified:
13 years, 12 months ago
Reviewers:
kbr1
CC:
angleproject-review_googlegroups.com
Base URL:
http://angleproject.googlecode.com/svn/trunk/
Visibility:
Public.

Description

Added tests for number types. Committed: https://code.google.com/p/angleproject/source/detail?r=1040

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -1 line) Patch
M tests/build_tests.gyp View 1 chunk +1 line, -0 lines 0 comments Download
A tests/preprocessor_tests/number_test.cpp View 1 chunk +140 lines, -0 lines 3 comments Download
M tests/preprocessor_tests/space_test.cpp View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 5
Alok Priyadarshi
14 years ago (2012-04-13 20:49:54 UTC) #1
kbr1
LGTM -- nice. http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_test.cpp File tests/preprocessor_tests/number_test.cpp (right): http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_test.cpp#newcode40 tests/preprocessor_tests/number_test.cpp:40: testing::Range('0', '7'))); How about negative tests, ...
13 years, 12 months ago (2012-04-13 21:18:31 UTC) #2
Alok Priyadarshi
http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_test.cpp File tests/preprocessor_tests/number_test.cpp (right): http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_test.cpp#newcode40 tests/preprocessor_tests/number_test.cpp:40: testing::Range('0', '7'))); I do not think that would be ...
13 years, 12 months ago (2012-04-13 21:45:56 UTC) #3
kbr1
http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_test.cpp File tests/preprocessor_tests/number_test.cpp (right): http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_test.cpp#newcode40 tests/preprocessor_tests/number_test.cpp:40: testing::Range('0', '7'))); On 2012/04/13 21:45:56, Alok Priyadarshi wrote: > ...
13 years, 12 months ago (2012-04-13 22:14:06 UTC) #4
Alok Priyadarshi
13 years, 12 months ago (2012-04-13 22:21:51 UTC) #5
You are right about the quality of error messages. In fact VC++ also produce
error messages similar to GCC. I think it will be possible to catch these kind
of errors in flex with a catch-all rule for each type. I will  try to figure it
out. Thanks for the examples.

On 2012/04/13 22:14:06, kbr1 wrote:
>
http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_...
> File tests/preprocessor_tests/number_test.cpp (right):
> 
>
http://codereview.appspot.com/6022045/diff/1/tests/preprocessor_tests/number_...
> tests/preprocessor_tests/number_test.cpp:40: testing::Range('0', '7')));
> On 2012/04/13 21:45:56, Alok Priyadarshi wrote:
> > I do not think that would be a bug as far as lexer is concerned. It will
just
> > tokenize a "08" as two integers - 0 and 8, which will later be rejected by
the
> > compiler due to syntax error.
> > 
> > I feel that if we try to capture these kind of errors at the lexer stage,
the
> > grammar will become too complicated. Do you have suggestion on handling
these
> > cases in a more general way. I do not want to special case for 08 and 09. It
> > should also handle "0x", where x is any character.
> 
> I don't know flex/bison well enough to know how to catch errors like this, but
> it seems to me that if the lexer doesn't catch it then it will be difficult to
> produce good error messages in the compiler, since it won't know that there
> wasn't whitespace between the valid prefix and invalid suffix. For example,
for
> this program:
> 
> int main()
> {
>     int 1a = 2;
>     return 0;
> }
> 
> gcc produces 'error: invalid suffix "a" on integer constant'. For:
> 
> 
> int main()
> {
>     int a = 08;
>     return 0;
> }
> 
> gcc produces 'error: invalid digit "8" in octal constant'. This is a different
> error than if there were a space between the 0 and the 8.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b