Permalink
Please sign in to comment.
Browse files
Implement echo -e, with extensive tests.
I use a simple regex lexer that can be ported to re2c eventually. I found a bugs / divergent behavior in various shells: - \1 - is \x01 or literal '\1'? - \x - is it the NUL byte or literal '\x'? Syntax error in C. - is \E implemented? TODO: What about \c?
- Loading branch information...
Showing
with
285 additions
and 15 deletions.
- +100 −1 core/builtin.py
- +22 −0 core/builtin_test.py
- +8 −0 core/id_kind.py
- +1 −0 core/id_kind_test.py
- +28 −0 core/lexer.py
- +1 −1 doc/osh-quick-ref-toc.txt
- +8 −2 osh/lex.py
- +115 −9 spec/builtin-io.test.sh
- +2 −2 test/spec.sh
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/python -S | ||
| """ | ||
| builtin_test.py: Tests for builtin.py | ||
| """ | ||
| import unittest | ||
| from core import lexer | ||
| from core import builtin # module under test | ||
| class BuiltinTest(unittest.TestCase): | ||
| def testEchoLexer(self): | ||
| lex = builtin.ECHO_LEXER | ||
| print list(lex.Tokens(r'newline \n NUL \0 octal \0377 hex \x00')) | ||
| print list(lex.Tokens(r'unicode \u0065 \U00000065')) | ||
| print list(lex.Tokens(r'\d \e \f \g')) | ||
| if __name__ == '__main__': | ||
| unittest.main() |
Oops, something went wrong.
0 comments on commit
9c8814d