aboutsummaryrefslogtreecommitdiff
path: root/module-test
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-09-17 08:54:32 +0000
committer_ov4 <ov4@ov4.org>2026-09-17 08:54:32 +0000
commit64717eba9de6e3dc60e47c322b5f1c1632ed3b21 (patch)
tree6d6f17f9610104cc4a548c8b0de0a7cf32048730 /module-test
parentcf117c70277fab4d3de170b55fe8248d9cc36927 (diff)
add quotation mark support
allow arguments of a command to be quoted
Diffstat (limited to 'module-test')
-rw-r--r--module-test/argument_printer.cc2
-rw-r--r--module-test/lexer_test.cc14
2 files changed, 14 insertions, 2 deletions
diff --git a/module-test/argument_printer.cc b/module-test/argument_printer.cc
index 8b8c6c3..4c23ff2 100644
--- a/module-test/argument_printer.cc
+++ b/module-test/argument_printer.cc
@@ -1,5 +1,5 @@
// print all arguments
-// $ g++ module-test/argument_printer.cc -std=c++23
+// $ g++ module-test/argument_printer.cc -std=c++23 -o module-test/argument_printer.out
#include <iostream>
diff --git a/module-test/lexer_test.cc b/module-test/lexer_test.cc
index 20e9556..cbc55d7 100644
--- a/module-test/lexer_test.cc
+++ b/module-test/lexer_test.cc
@@ -6,6 +6,7 @@ g++ \
src/lexer/token.cc \
src/lexer/ast.cc \
src/lexer/symbol_property.cc \
+ src/util/string.cc \
-std=c++23 -Iinclude -Ithird_party/magic_enum/include \
-O0 -ggdb3 -fno-omit-frame-pointer -fno-inline -D_GLIBCXX_ASSERTIONS \
-o module-test/lexer_test.out
@@ -27,6 +28,7 @@ g++ \
#include "lexer/token.h"
#include "global.h"
#include "error.h"
+#include "util/string.h"
using namespace std;
using namespace ov4;
@@ -37,7 +39,7 @@ constexpr int MAXLINE = 1024;
int main()
{
verbose = true;
- int test_case = 17;
+ int test_case = 19;
string s;
switch (test_case)
@@ -126,6 +128,16 @@ int main()
s = "((alpha)";
break;
+ // quotation mark in command
+ case 18:
+ s = "argument_printer.out \"hello hi\" second third &";
+ break;
+
+ // harder quotation mark test
+ case 19:
+ s = "alpha \"arg1 arg2 \'arg3 arg4\' arg5\" && beta &";
+ break;
+
default:
return 0;
}