Review comments
This commit is contained in:
@@ -15,13 +15,13 @@ static int testsFailed = 0;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define ASSERT_TRUE(cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
#define ASSERT_TRUE(cond) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
fprintf(stderr, " FAIL: %s:%d: %s is false\n", __FILE__, __LINE__, #cond); \
|
||||
testsFailed++; \
|
||||
return; \
|
||||
} \
|
||||
testsFailed++; \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define PASS() testsPassed++
|
||||
@@ -42,6 +42,14 @@ void testInlineUnderlineLineThrough() {
|
||||
PASS();
|
||||
}
|
||||
|
||||
void testInlineLineThroughUnderlineOrderInsensitive() {
|
||||
printf("testInlineLineThroughUnderlineOrderInsensitive...\n");
|
||||
const CssStyle style = CssParser::parseInlineStyle("text-decoration: line-through underline");
|
||||
ASSERT_TRUE(style.hasTextDecoration());
|
||||
ASSERT_EQ(style.textDecoration, CssTextDecoration::UnderlineLineThrough);
|
||||
PASS();
|
||||
}
|
||||
|
||||
void testInlineTextDecorationNormalization() {
|
||||
printf("testInlineTextDecorationNormalization...\n");
|
||||
const CssStyle style = CssParser::parseInlineStyle("TEXT-DECORATION : LINE-THROUGH ;");
|
||||
@@ -55,6 +63,7 @@ int main() {
|
||||
|
||||
testInlineLineThrough();
|
||||
testInlineUnderlineLineThrough();
|
||||
testInlineLineThroughUnderlineOrderInsensitive();
|
||||
testInlineTextDecorationNormalization();
|
||||
|
||||
printf("\n=== Results: %d passed, %d failed ===\n", testsPassed, testsFailed);
|
||||
|
||||
@@ -78,6 +78,15 @@ void testStrikethroughWorks() {
|
||||
PASS();
|
||||
}
|
||||
|
||||
void testEscapedTildeDoesNotToggleStrikethrough() {
|
||||
printf("testEscapedTildeDoesNotToggleStrikethrough...\n");
|
||||
auto spans = MdParser::parseInline("foo \\~~bar~~ baz");
|
||||
ASSERT_EQ(flattenText(spans), "foo ~~bar~~ baz");
|
||||
ASSERT_EQ(spans.size(), 1);
|
||||
ASSERT_EQ(spans[0].style, EpdFontFamily::REGULAR);
|
||||
PASS();
|
||||
}
|
||||
|
||||
void testUnderscoreBoldWorks() {
|
||||
printf("testUnderscoreBoldWorks...\n");
|
||||
auto spans = MdParser::parseInline("foo __bar__ baz");
|
||||
@@ -116,6 +125,7 @@ int main() {
|
||||
testAsteriskEmphasisStillWorks();
|
||||
testStrikethroughWorks();
|
||||
testUnderscoreBoldWorks();
|
||||
testEscapedTildeDoesNotToggleStrikethrough();
|
||||
testNestedUnorderedListIndentLevel();
|
||||
testNestedOrderedListIndentLevel();
|
||||
|
||||
|
||||
@@ -7,6 +7,16 @@ BINARY="$BUILD_DIR/CssParserTest"
|
||||
PLATFORMIO_DIR="${PLATFORMIO_CORE_DIR:-$HOME/.platformio}"
|
||||
ARDUINO_FRAMEWORK_DIR="$PLATFORMIO_DIR/packages/framework-arduinoespressif32"
|
||||
|
||||
if [ ! -d "$PLATFORMIO_DIR" ]; then
|
||||
echo "ERROR: PLATFORMIO_DIR does not exist: $PLATFORMIO_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$ARDUINO_FRAMEWORK_DIR" ]; then
|
||||
echo "ERROR: ARDUINO_FRAMEWORK_DIR does not exist: $ARDUINO_FRAMEWORK_DIR" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$BUILD_DIR"
|
||||
|
||||
SOURCES=(
|
||||
|
||||
Reference in New Issue
Block a user