stern4rust/finding/unit_test_site.rs
1// Copyright 2025 Umberto Gotti <umberto.gotti@umbertogotti.dev>
2// Licensed under the MIT License
3// SPDX-License-Identifier: MIT
4
5// One place in the production source tree where a test, or the machinery of a
6// test, is living.
7//
8// The correction is built here rather than by the rule because the finder is
9// the only thing that knows which of the two offences it found: a test belongs
10// in the mirrored test file, while a conditional attribute has to stop being
11// conditional. One instruction would have to cover both, and would say nothing
12// useful about either.
13#[derive(Debug, Clone, PartialEq, Eq)]
14pub struct UnitTestSite {
15 pub line: usize,
16 pub label: String,
17 pub correction: String,
18}
19
20impl UnitTestSite {
21 pub fn new(line: usize, label: &str, correction: &str) -> Self {
22 Self {
23 line,
24 label: label.to_string(),
25 correction: correction.to_string(),
26 }
27 }
28}