Skip to content

Commit 423f0c2

Browse files
committed
🎨 style(lint): Fix style erros
1 parent 5a155d1 commit 423f0c2

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

‎include/libserial/ports.hpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Ports() = default;
4646
* Primarily intended for testing to inject a non-existent or
4747
* non-readable directory to validate error handling paths.
4848
*/
49-
explicit Ports(const char* sys_path) : sys_path_(sys_path) {}
49+
explicit Ports(const char* sys_path) : sys_path_(sys_path) {
50+
}
5051

5152
/**
5253
* @brief Destroyer of the Ports class

‎src/ports.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ uint16_t Ports::scanPorts() {
2626
const char* by_id_dir = sys_path_;
2727
DIR* dir = opendir(by_id_dir);
2828
if (!dir) {
29-
throw PortNotFoundException("Error while reading " + std::string(by_id_dir) + ": " + strerror(errno));
29+
throw PortNotFoundException("Error while reading " + std::string(by_id_dir) + ": " +
30+
strerror(errno));
3031
}
3132

3233
// The POSIX directory-entry structure used by readdir() to describe files

‎test/test_ports.cpp‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <unistd.h>
88
#include <memory>
99
#include <string>
10+
#include <iostream>
1011

1112
#include "libserial/ports.hpp"
1213
#include "libserial/serial_exception.hpp"
@@ -51,24 +52,25 @@ TEST_F(PortsTest, ScanPortsThrowsWhenPathMissing) {
5152
libserial::Ports ports(missing_path);
5253

5354

54-
try {
55+
try {
5556
(void)ports.scanPorts();
5657
FAIL() << "Expected libserial::SerialException to be thrown";
57-
} catch (const libserial::SerialException& e) {
58+
}
59+
catch (const libserial::SerialException& e) {
5860
std::cout << "Caught SerialException: " << e.what() << std::endl;
5961
// Optionally assert something about the message:
6062
EXPECT_NE(std::string(e.what()).find("Error while reading"), std::string::npos);
61-
} catch (...) {
63+
}
64+
catch (...) {
6265
FAIL() << "Expected libserial::SerialException, but got a different exception";
6366
}
6467
}
6568

6669
TEST_F(PortsTest, ScanPortsWithFakeDevices) {
67-
6870
// Create fake device symlinks
6971
std::string fake_device1 = std::string(temp_dir_) + "/usb-FTDI_FT232R_USB_UART_A1B2C3D4";
7072
std::string fake_device2 = std::string(temp_dir_) + "/usb-Arduino_Uno_12345678";
71-
73+
7274
// Create symlinks pointing to fake /dev/ttyUSB* paths
7375
// The actual target doesn't need to exist for scanPorts to process it
7476
ASSERT_EQ(symlink("../../ttyUSB0", fake_device1.c_str()), 0);
@@ -80,7 +82,7 @@ TEST_F(PortsTest, ScanPortsWithFakeDevices) {
8082
EXPECT_NO_THROW({
8183
count = ports.scanPorts();
8284
});
83-
85+
8486
EXPECT_EQ(count, 2) << "Should find 2 fake devices";
8587

8688
EXPECT_EQ(ports.findName(1).value(), "usb-FTDI_FT232R_USB_UART_A1B2C3D4");

0 commit comments

Comments
 (0)