1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-26 20:53:50 +00:00

C++ components unit test framework (#9284)

Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Javier Peletier
2025-10-22 00:21:22 +02:00
committed by GitHub
parent 1ea80594c6
commit ae50a09b4e
15 changed files with 710 additions and 80 deletions

26
tests/components/main.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include <gtest/gtest.h>
/*
This special main.cpp replaces the default one.
It will run all the Google Tests found in all compiled cpp files and then exit with the result
See README.md for more information
*/
// Auto generated code by esphome
// ========== AUTO GENERATED INCLUDE BLOCK BEGIN ===========
// ========== AUTO GENERATED INCLUDE BLOCK END ==========="
void original_setup() {
// This function won't be run.
// ========== AUTO GENERATED CODE BEGIN ===========
// =========== AUTO GENERATED CODE END ============
}
void setup() {
::testing::InitGoogleTest();
int exit_code = RUN_ALL_TESTS();
exit(exit_code);
}
void loop() {}