Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
a435de0e
Commit
a435de0e
authored
Dec 17, 2012
by
Michal 'vorner' Vaner
Browse files
[2427] Find INITIAL_WS even at the beginning of file
parent
f74f25e7
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/lib/dns/master_lexer.cc
View file @
a435de0e
...
...
@@ -37,7 +37,7 @@ using namespace master_lexer_internal;
struct
MasterLexer
::
MasterLexerImpl
{
MasterLexerImpl
()
:
source_
(
NULL
),
token_
(
MasterToken
::
NOT_STARTED
),
paren_count_
(
0
),
last_was_eol_
(
fals
e
),
paren_count_
(
0
),
last_was_eol_
(
tru
e
),
has_previous_
(
false
),
previous_paren_count_
(
0
),
previous_was_eol_
(
false
)
...
...
src/lib/dns/master_lexer.h
View file @
a435de0e
...
...
@@ -54,7 +54,8 @@ public:
END_OF_LINE
,
///< End of line detected
END_OF_FILE
,
///< End of file detected
INITIAL_WS
,
///< White spaces at the beginning of a line after an
///< end of line (if asked for detecting it)
///< end of line or at the beginning of file (if asked
// for detecting it)
NOVALUE_TYPE_MAX
=
INITIAL_WS
,
///< Max integer corresponding to
/// no-value (type only) types.
/// Mainly for internal use.
...
...
src/lib/dns/tests/master_lexer_state_unittest.cc
View file @
a435de0e
...
...
@@ -190,13 +190,16 @@ TEST_F(MasterLexerStateTest, unbalancedParentheses) {
}
TEST_F
(
MasterLexerStateTest
,
startToComment
)
{
// Begin with 'start',
skip
space, then encounter a comment. Skip
// Begin with 'start',
detect
space, then encounter a comment. Skip
// the rest of the line, and recognize the new line. Note that the
// second ';' is simply ignored.
ss
<<
" ;a;
\n
"
;
ss
<<
";a;"
;
// Likewise, but the comment ends with EOF.
lexer
.
pushSource
(
ss
);
// Initial whitespace (asked for in common_options)
EXPECT_EQ
(
s_null
,
State
::
start
(
lexer
,
common_options
));
EXPECT_EQ
(
Token
::
INITIAL_WS
,
s_crlf
.
getToken
(
lexer
).
getType
());
// Comment ending with EOL
EXPECT_EQ
(
s_null
,
State
::
start
(
lexer
,
common_options
));
EXPECT_EQ
(
Token
::
END_OF_LINE
,
s_crlf
.
getToken
(
lexer
).
getType
());
...
...
src/lib/dns/tests/master_lexer_unittest.cc
View file @
a435de0e
...
...
@@ -238,10 +238,8 @@ TEST_F(MasterLexerTest, ungetToken) {
// Check ungetting token without overriding the start method. We also
// check it works well with changing options between the calls.
TEST_F
(
MasterLexerTest
,
ungetRealOptions
)
{
ss
<<
"
\n
\n
"
;
ss
<<
"
\n
"
;
lexer
.
pushSource
(
ss
);
// Skip the first newline
EXPECT_EQ
(
MasterToken
::
END_OF_LINE
,
lexer
.
getNextToken
().
getType
());
// If we call it the usual way, it skips up to the newline and returns
// it
...
...
src/lib/dns/tests/master_loader_unittest.cc
View file @
a435de0e
...
...
@@ -789,9 +789,8 @@ TEST_F(MasterLoaderTest, noPreviousName) {
loader_
->
load
();
EXPECT_FALSE
(
loader_
->
loadedSucessfully
());
EXPECT_EQ
(
1
,
errors_
.
size
());
checkCallbackMessage
(
errors_
.
at
(
0
),
"x"
,
1
);
checkCallbackMessage
(
errors_
.
at
(
0
),
"No previous name to use in place of "
"initial whitespace"
,
1
);
EXPECT_TRUE
(
warnings_
.
empty
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment