aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile14
-rw-r--r--README.md4
-rw-r--r--prettier.py15
3 files changed, 22 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 7de97b8..48cf7ce 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
FT_PRINTF_PATH = ../ft_printf
CC = gcc
-CCFLAGS = -Wall -Wextra -Wno-format -g
+CCFLAGS = -Wall -Wextra -Wno-format
LDFLAGS = -L$(FT_PRINTF_PATH) -lftprintf
NAME = ft_printf_test
@@ -12,17 +12,18 @@ MAKE = make -j4
SRC = main.c helper.c tests/pft_tests.c tests/moulitest_tests.c
OBJ = $(SRC:.c=.o)
-run: run_pretty
-
-run_pretty: all
+run: all
./$(NAME) | $(PYTHON) prettier.py
-run_pretty_verbose:
+run_verbose:
./$(NAME) | $(PYTHON) prettier.py --verbose
-run_pretty_quiet:
+run_quiet:
./$(NAME) | $(PYTHON) prettier.py --quiet
+run_no_clear:
+ ./$(NAME) | $(PYTHON) prettier.py --no-clear
+
run_raw: all
./$(NAME)
@@ -41,6 +42,7 @@ fclean: clean
$(RM) $(NAME)
re: fclean all
+ $(MAKE) -C $(FT_PRINTF_PATH) re
ft_printf_all:
$(MAKE) -C $(FT_PRINTF_PATH) all
diff --git a/README.md b/README.md
index eccdeb5..d305b9f 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Clone this repo such that:
or modify the `FT_PRINTF_PATH` variable in the Makefile
- `> make run`: run the tests in a pretty format
+- `> make run_verbose`: to show a more verbose output
+- `> make run_quiet`: to show a more quiet output
- `> make run_raw`: run the tests in a ugly but parsable format
-- `> make run_prettier_verbose`: to show a more verbose output
-- `> make run_prettier_quiet`: to show a more quiet output
- `> python3 prettier -h`: show prettier options
diff --git a/prettier.py b/prettier.py
index 9425f80..75ccd66 100644
--- a/prettier.py
+++ b/prettier.py
@@ -1,3 +1,4 @@
+import os
import sys
import argparse
@@ -18,6 +19,7 @@ def parse_args():
help="decrease vebosity", action="store_true")
parser.add_argument("-l", "--no-log",
help="disable result log", action="store_true")
+ parser.add_argument("-c", "--no-clear", help="disable terminal clear before output")
parser.add_argument("-f", "--output-file", help="output file name")
return vars(parser.parse_args(sys.argv[1:]))
@@ -51,9 +53,14 @@ def write_logs(logs, options):
filename = options["output_file"]
with open(filename, "w") as log_file:
for ko in logs["ko_info"]:
- log_file.write("- " + ko["msg"] + "\n")
- log_file.write(" " + ko["expected"] + "\n")
- log_file.write(" " + ko["actual"] + "\n\n")
+ try:
+ log_file.write("- " + ko["msg"]+ "\n")
+ log_file.write(" " + ko["expected"] + "\n")
+ log_file.write(" " + ko["actual"] + "\n")
+ except UnicodeEncodeError:
+ log_file.write("Can't write detail\n")
+ finally:
+ log_file.write("\n")
def print_logs(logs, options):
@@ -75,6 +82,8 @@ def print_logs(logs, options):
if __name__ == "__main__":
print()
options = parse_args()
+ if not options["no_clear"]:
+ os.system("clear")
logs = parse()
print_logs(logs, options)
if not options["no_log"]: