diff options
-rw-r--r-- | miscutils/bc.c | 7 | ||||
-rwxr-xr-x | testsuite/bc.tests | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 9c7e69fc1..dc9a7da8e 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -7088,10 +7088,13 @@ static BC_STATUS zbc_vm_stdin(void) | |||
7088 | string++; | 7088 | string++; |
7089 | if (c == '/' && *string == '*') { | 7089 | if (c == '/' && *string == '*') { |
7090 | comment = true; | 7090 | comment = true; |
7091 | break; | 7091 | string++; |
7092 | continue; | ||
7092 | } | 7093 | } |
7093 | if (c == '*' && *string == '/') | 7094 | if (c == '*' && *string == '/') { |
7094 | comment = false; | 7095 | comment = false; |
7096 | string++; | ||
7097 | } | ||
7095 | } | 7098 | } |
7096 | if (str || comment || string[-2] == '\\') { | 7099 | if (str || comment || string[-2] == '\\') { |
7097 | bc_vec_concat(&buffer, buf.v); | 7100 | bc_vec_concat(&buffer, buf.v); |
diff --git a/testsuite/bc.tests b/testsuite/bc.tests index 32460092b..4f0d50f73 100755 --- a/testsuite/bc.tests +++ b/testsuite/bc.tests | |||
@@ -4,6 +4,18 @@ | |||
4 | 4 | ||
5 | . ./testing.sh | 5 | . ./testing.sh |
6 | 6 | ||
7 | # testing "test name" "command" "expected result" "file input" "stdin" | ||
8 | |||
9 | testing "bc comment 1" \ | ||
10 | "bc" \ | ||
11 | "3\n" \ | ||
12 | "" "1 /* comment */ + 2" | ||
13 | |||
14 | testing "bc comment 2: /*/ is not a closed comment" \ | ||
15 | "bc" \ | ||
16 | "4\n" \ | ||
17 | "" "1 /*/ + 2 */ + 3" | ||
18 | |||
7 | tar xJf bc_large.tar.xz | 19 | tar xJf bc_large.tar.xz |
8 | 20 | ||
9 | for f in bc*.bc; do | 21 | for f in bc*.bc; do |