Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(yaml): properly escape double quotes #3965

Merged
merged 4 commits into from
Nov 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Shorten test string for B&W radios.
philmoz committed Nov 10, 2023
commit 9b5339c17eeeebf6a72fb8542b6ee564068d5dcc
20 changes: 10 additions & 10 deletions radio/src/tests/model.cpp
Original file line number Diff line number Diff line change
@@ -30,20 +30,20 @@ static const char* _model_config[] =
{
// As written by radio firmware - always enclosed in double quotes
"header: \n"
" name: \"Test Name\"\n", // no embedded double quote
" name: \"Tst Name\"\n", // no embedded double quote

"header: \n"
" name: \"Test \\x22 Name\"\n", // embedded and encoded double quote
" name: \"Tst \\x22 Name\"\n", // embedded and encoded double quote

// As written by Companion - only enclosed in double quotes when necessary
"header: \n"
" name: Test Name\n", // no embedded double quote
" name: Tst Name\n", // no embedded double quote

"header: \n"
" name: Test \" Name\n", // embedded double quote in string
" name: Tst \" Name\n", // embedded double quote in string

"header: \n"
" name: \"\\\"Test Name\"\n", // embedded double quote at start of string
" name: \"\\\"Tst Name\"\n", // embedded double quote at start of string
};

static void loadModelYamlStr(const char* str)
@@ -69,13 +69,13 @@ static char* modelName()
TEST(Model, testModelNameParse)
{
loadModelYamlStr(_model_config[0]);
EXPECT_STREQ(modelName(), "Test Name");
EXPECT_STREQ(modelName(), "Tst Name");
loadModelYamlStr(_model_config[1]);
EXPECT_STREQ(modelName(), "Test \" Name");
EXPECT_STREQ(modelName(), "Tst \" Name");
loadModelYamlStr(_model_config[2]);
EXPECT_STREQ(modelName(), "Test Name");
EXPECT_STREQ(modelName(), "Tst Name");
loadModelYamlStr(_model_config[3]);
EXPECT_STREQ(modelName(), "Test \" Name");
EXPECT_STREQ(modelName(), "Tst \" Name");
loadModelYamlStr(_model_config[4]);
EXPECT_STREQ(modelName(), "\"Test Name");
EXPECT_STREQ(modelName(), "\"Tst Name");
}