diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2022-06-08 13:54:36 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2022-06-08 13:54:36 +0300 |
commit | f20c12dd9f920eee1f50f99c8a4c86730e40432c (patch) | |
tree | 368589dced3bd8ccace010d423d514494e4d32ab | |
parent | d8ac772cb5217df8fce435307524242a50153a07 (diff) | |
download | foodtools-f20c12dd9f920eee1f50f99c8a4c86730e40432c.tar.gz foodtools-f20c12dd9f920eee1f50f99c8a4c86730e40432c.tar.bz2 foodtools-f20c12dd9f920eee1f50f99c8a4c86730e40432c.zip |
Update emacs mode and tests for empty ingredients
-rw-r--r-- | emacs/recipe-mode.el | 1 | ||||
-rw-r--r-- | tests/parser.c | 14 |
2 files changed, 10 insertions, 5 deletions
diff --git a/emacs/recipe-mode.el b/emacs/recipe-mode.el index 320d017..d88f8cf 100644 --- a/emacs/recipe-mode.el +++ b/emacs/recipe-mode.el @@ -39,6 +39,7 @@ ("=>\\(.*\\)" . (1 'font-lock-variable-name-face)) ;; step result ("^[ [:digit:]]*!" . 'font-lock-constant-face) ;; include ("@\\|-\\|>\\|+\\|=>" . 'font-lock-constant-face) ;; symbols + ("^\\(.+?\\)$" . (1 'font-lock-variable-name-face)) ;; variable in assignment (no qty) )) (define-derived-mode recipe-mode prog-mode "rcp" diff --git a/tests/parser.c b/tests/parser.c index 694653b..ae85fc5 100644 --- a/tests/parser.c +++ b/tests/parser.c @@ -109,13 +109,17 @@ START_TEST(check_parse_item) ck_assert_str_eq(r->i[r->in - 1]->name, "test"); ck_assert_str_eq(r->i[r->in - 1]->qty, "val"); - is1(parse_item("wrong!", r, (pt *)NULL, error)); - ck_assert_str_eq(r->i[r->in - 1]->name, "test"); - ck_assert_str_eq(r->i[r->in - 1]->qty, "val"); + is0(parse_item("noqty", r, (pt *)NULL, error)); + ck_assert_str_eq(r->i[r->in - 1]->name, "noqty"); + ck_assert_str_eq(r->i[r->in - 1]->qty, "*"); + + is0(parse_item("noqty2, noqty3", r, (pt *)NULL, error)); + ck_assert_str_eq(r->i[r->in - 1]->name, "noqty3"); + ck_assert_str_eq(r->i[r->in - 1]->qty, "*"); is0(parse_item("---", r, (pt *)NULL, error)); - ck_assert_str_eq(r->i[r->in - 1]->name, "test"); - ck_assert_str_eq(r->i[r->in - 1]->qty, "val"); + ck_assert_str_eq(r->i[r->in - 1]->name, "noqty3"); + ck_assert_str_eq(r->i[r->in - 1]->qty, "*"); free_recipe(r); } |