refactor: move html_util into legacy core library
This commit is contained in:
4
lib/dd3_legacy_core/include/dd3_legacy_core.h
Normal file
4
lib/dd3_legacy_core/include/dd3_legacy_core.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
// Include this header in legacy Unity tests to force-link dd3_legacy_core.
|
||||
void dd3_legacy_core_force_link();
|
||||
7
lib/dd3_legacy_core/include/html_util.h
Normal file
7
lib/dd3_legacy_core/include/html_util.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
String html_escape(const String &input);
|
||||
String url_encode_component(const String &input);
|
||||
bool sanitize_device_id(const String &input, String &out_device_id);
|
||||
3
lib/dd3_legacy_core/src/dd3_legacy_core.cpp
Normal file
3
lib/dd3_legacy_core/src/dd3_legacy_core.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "dd3_legacy_core.h"
|
||||
|
||||
void dd3_legacy_core_force_link() {}
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <Arduino.h>
|
||||
#include <unity.h>
|
||||
#include "dd3_legacy_core.h"
|
||||
#include "html_util.h"
|
||||
|
||||
static void test_html_escape_basic() {
|
||||
@@ -121,6 +122,7 @@ static void test_sanitize_device_id_rejects_invalid() {
|
||||
}
|
||||
|
||||
void setup() {
|
||||
dd3_legacy_core_force_link();
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_html_escape_basic);
|
||||
RUN_TEST(test_html_escape_adversarial);
|
||||
|
||||
Reference in New Issue
Block a user