Permalink
Browse files

doc: Cleanup + prepearing a new test-sample

  • Loading branch information...
MikeMitterer committed Aug 28, 2017
1 parent e3985ee commit 7add301d1a7278c15895197df4566aabbfb43ea8
Showing with 18 additions and 14 deletions.
  1. +7 −5 lib/parser/Lexer.dart
  2. +9 −7 test/unit/_resources/login.dart.txt
  3. +2 −2 test/unit/parser/Parser_test.dart
View
@@ -104,19 +104,16 @@ class Lexer {
}
else if (_isNext('_(')) {
_skip('_(');
//state = TokenizeState.L10N;
tokens.add(new Token("_(", TokenType.L10N));
token = "";
}
else if (_isNext('l10n(')) {
_skip('l10n(');
//state = TokenizeState.L10N;
tokens.add(new Token("l10(", TokenType.L10N));
token = "";
}
else if (_isNext('gettext(')) {
_skip('gettext(');
//state = TokenizeState.L10N;
tokens.add(new Token("gettext(", TokenType.L10N));
token = "";
}
@@ -168,13 +165,18 @@ class Lexer {
break;
case TokenizeState.STRING_DOUBLE_QUOTE:
case TokenizeState.STRING_SINGLE_QUOTE:
if (c == '"' && !_isPrev('\\')) {
tokens.add(new Token(token, TokenType.STRING));
token = "";
state = TokenizeState.DEFAULT;
}
else if (c == "'" && !_isPrev('\\')) {
else {
token += c;
}
break;
case TokenizeState.STRING_SINGLE_QUOTE:
if (c == "'" && !_isPrev('\\')) {
tokens.add(new Token(token, TokenType.STRING));
token = "";
state = TokenizeState.DEFAULT;
@@ -71,6 +71,8 @@ class LoginDialog extends MaterialDialog {
print(translate(_("Test \"4\"")));
print(translate(_("Test (5)")));
print("Hallo ${_('Test 6'} --!");
}
// Must not appear in scan
@@ -89,32 +91,32 @@ class LoginDialog extends MaterialDialog {
<h5 class="mdl-form__title" translate='yes'>
<!-- Multi line
HTML Kommentar -->
l10n('Test 6')</h5>
l10n('Test 7')</h5>
<div class="mdl-form__content">
<div class="mdl-textfield">
<input class="mdl-textfield__input" type="email" id="email" mdl-model="username" required autofocus>
<label class="mdl-textfield__label" for="email" translate='yes'>_('Test 7')</label>
<span class="mdl-textfield__error" translate='yes'>_('Test 8: This is not a valid eMail-Address')</span>
<label class="mdl-textfield__label" for="email" translate='yes'>_('Test 8')</label>
<span class="mdl-textfield__error" translate='yes'>_('Test 9: This is not a valid eMail-Address')</span>
</div>
<div class="mdl-textfield">
<input class="mdl-textfield__input" type=password id="password" mdl-model="password"
pattern="((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#\$%?]).{8,15})" required>
<label class="mdl-textfield__label" for="password" translate='yes'>_('Test 9: Password')</label>
<label class="mdl-textfield__label" for="password" translate='yes'>_('Test 10: Password')</label>
<span class="mdl-textfield__error" translate='yes'>
<!-- HTML-Kommentar -->
_('Test 10: 12345678aA16#')
_('Test 11: 12345678aA16#')
</span>
</div>
<div class="mdl-form__hint">
<a href="#" target="_blank" translate='yes'>_('Test 11: Forgot your password?')</a>
<a href="#" target="_blank" translate='yes'>_('Test 12: Forgot your password?')</a>
</div>
</div>
<div class="mdl-form__actions">
<button id="submit" class="mdl-button mdl-button--submit
mdl-button--raised mdl-button--primary"
data-mdl-click="onLogin(\$event)" translate='yes'>
_('Test 12: Sign in')
_('Test 13: Sign in')
</button>
</div>
</form>
@@ -59,9 +59,9 @@ main() async {
final int nrOfFunctions = tokens.where((final Token token) =>
token.type == TokenType.L10N).length;
// 14 - but one is a function declaration!
expect(nrOfComments, equals(15));
expect(nrOfFunctions, equals(12));
// 13 - but one is a function declaration!
expect(nrOfFunctions, equals(13));
}); // end of 'Test' test
});
// End of 'Parser' group

0 comments on commit 7add301

Please sign in to comment.