-
Notifications
You must be signed in to change notification settings - Fork 0
Done with LS CAT WC PWD #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
нет комментариев, совсем
7 баллов
; | ||
|
||
assignment : name=WORD '=' value=WORD #wordAssignment | ||
| name=WORD '=' '$' value=WORD #variableAssignment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Странно, что присваивать можно только WORD
и $WORD
, а как же строки в кавычках?
String noQuotes = dqstr.substring(1, dqstr.length() - 1); | ||
|
||
for (Map.Entry<String, String> entry : Environment.values.entrySet()) { | ||
if (noQuotes.contains("$"+entry.getKey())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пробелы вокруг операторов
String noQuotes = dqstr.substring(1, dqstr.length() - 1); | ||
|
||
for (Map.Entry<String, String> entry : Environment.values.entrySet()) { | ||
if (noQuotes.contains("$"+entry.getKey())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Пробелы вокруг операторов
@Test | ||
public void testSimpleEcho() { | ||
String expected = "hello\n"; | ||
String actual = Bash.runExternal("echo hello"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это интеграционные тесты, нужно ещё юнит-тесты писать
@Test | ||
public void testSimpleEcho() { | ||
String expected = "hello\n"; | ||
String actual = Bash.runExternal("echo hello"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это интеграционные тесты, нужно ещё юнит-тесты писать
String interpret(BashNode node) throws Exception { | ||
if (node != null) { | ||
if (node instanceof BashPipeline) { | ||
result = interpret(((BashPipeline) node).left()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут бы хорошо подошёл switch
, для этого значение какого-то enum
лучше держать
try { | ||
result = interpreter.interpret(rootNodeGood); | ||
} catch (Exception e) { | ||
// e.printStackTrace(); for debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не должно быть закомментированного кода
try { | ||
result = interpreter.interpret(rootNodeGood); | ||
} catch (Exception e) { | ||
// e.printStackTrace(); for debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не должно быть закомментированного кода
result = interpreter.interpret(rootNodeGood); | ||
} catch (Exception e) { | ||
// e.printStackTrace(); for debug | ||
result = e + "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему игнорируется исключение и тупо stdout
пишется?
result = interpreter.interpret(rootNodeGood); | ||
} catch (Exception e) { | ||
// e.printStackTrace(); for debug | ||
result = e + "\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему игнорируется исключение и тупо stdout
пишется?
No description provided.