Allow tags to be enclosed in double quotes

Closes #159

Signed-off-by: Shaun Ruffell <sruffell@sruffell.net>
This commit is contained in:
Shaun Ruffell 2021-04-06 01:48:32 -05:00 committed by Thomas Lauf
parent fd6d57dbc2
commit 0460656afe
4 changed files with 9 additions and 7 deletions

View file

@ -219,7 +219,7 @@ void CLI::lexArguments ()
if (lex.token (lexeme, type) &&
lex.isEOS ())
{
A2 a (Lexer::dequote (_original_args[i].attribute ("raw")), type);
A2 a (_original_args[i].attribute ("raw"), type);
if (quoted)
a.tag ("QUOTED");

View file

@ -28,7 +28,6 @@
#include <TagInfoDatabase.h>
#include <format.h>
#include <TagInfo.h>
#include "timew.h"
///////////////////////////////////////////////////////////////////////////////

View file

@ -54,11 +54,6 @@ std::string escape (const std::string& input, int c)
////////////////////////////////////////////////////////////////////////////////
std::string quoteIfNeeded (const std::string& input)
{
if (input[0] == '"' || input[0] == '\'')
{
return input;
}
auto quote = input.find ('"');
auto space = input.find (' ');
auto op = input.find_first_of ("+-/()<^!=~_%");

View file

@ -277,6 +277,14 @@ class TestStart(TestCase):
self.t("start 1h ago proja")
code, out, err = self.t("start 2h ago proja :adjust")
def test_start_with_one_quoted_and_one_non_quoted_tag(self):
"""Start will allow tags encased in quotes"""
self.t("start 1h ago foo '\"bar\"' :debug")
j = self.t.export()
self.assertOpenInterval(j[0],
expectedTags=["\"bar\"", "foo"])
if __name__ == "__main__":
from simpletap import TAPTestRunner