Skip to content

Done with LS CAT WC PWD#3

Open
lectricas wants to merge 1 commit intomasterfrom
feature_antlr
Open

Done with LS CAT WC PWD#3
lectricas wants to merge 1 commit intomasterfrom
feature_antlr

Conversation

@lectricas
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@ottergottaott ottergottaott left a 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
Copy link
Copy Markdown

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())) {
Copy link
Copy Markdown

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())) {
Copy link
Copy Markdown

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");
Copy link
Copy Markdown

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");
Copy link
Copy Markdown

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());
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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";
Copy link
Copy Markdown

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";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему игнорируется исключение и тупо stdout пишется?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants