Link the ordinary tests once, and keep their debug info to line tables
Eleven `tests/*.rs` were eleven binaries, each linking the whole graph -- `wgpu` and all -- to run a handful of cases. They are modules of one target now, under `tests/cases/`, and `cargo test --test suite layout::` still picks one out. The fuzzers and the `*_cost` measurements stay their own targets: they are run on their own and want to be selectable without building the rest. `profile.test` takes `debug = "line-tables-only"`, which is what a backtrace here actually reads; the type and variable information was the bulk of what the linker was writing. Measured on this machine, rebuilding `iris`'s test targets after a change to the crate: 14.3 s before, 9.8 s with one target, 7.7 s with both. `target/` went from 45 GB to 13 GB. The suite still passes 102 tests, and the binary still carries `.debug_line`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39e4ca20e6
commit
cb955f1023
13 files changed
+35
No files matched your search
@@ -0,0 +1,67 @@
|
||||
use iris::prelude::*;
|
||||
|
||||
fn editor(text: &str, mode: EditMode) -> (TextEdit, TextData) {
|
||||
let view = TextView::new(TextBuffer::new(text), TextAttrs::default(), None);
|
||||
(TextEdit::new(view, mode), TextData::default())
|
||||
}
|
||||
|
||||
fn press(edit: &mut TextEditCtx<'_>, x: f32) {
|
||||
edit.select(vec2(x, 10.0), vec2(400.0, 200.0), false, false);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pressing_an_empty_field_places_input() {
|
||||
let (mut text, mut data) = editor("", EditMode::SingleLine);
|
||||
let mut edit = TextEditCtx {
|
||||
text: &mut text,
|
||||
data: &mut data,
|
||||
};
|
||||
|
||||
press(&mut edit, 40.0);
|
||||
edit.insert("hello");
|
||||
|
||||
assert_eq!(edit.text.content(), "hello");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn preedit_replaces_the_previous_composition() {
|
||||
let (mut text, mut data) = editor("", EditMode::SingleLine);
|
||||
let mut edit = TextEditCtx {
|
||||
text: &mut text,
|
||||
data: &mut data,
|
||||
};
|
||||
|
||||
press(&mut edit, 0.0);
|
||||
edit.replace(0, "に");
|
||||
edit.replace(1, "日本");
|
||||
|
||||
assert_eq!(edit.text.content(), "日本");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn backspace_respects_utf8_boundaries() {
|
||||
let (mut text, mut data) = editor("aé", EditMode::SingleLine);
|
||||
let mut edit = TextEditCtx {
|
||||
text: &mut text,
|
||||
data: &mut data,
|
||||
};
|
||||
|
||||
press(&mut edit, f32::MAX);
|
||||
edit.backspace(false);
|
||||
|
||||
assert_eq!(edit.text.content(), "a");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn typing_replaces_the_selection() {
|
||||
let (mut text, mut data) = editor("hello", EditMode::SingleLine);
|
||||
let mut edit = TextEditCtx {
|
||||
text: &mut text,
|
||||
data: &mut data,
|
||||
};
|
||||
|
||||
edit.select_all();
|
||||
edit.insert("goodbye");
|
||||
|
||||
assert_eq!(edit.text.content(), "goodbye");
|
||||
}
|
||||
Reference in new issue
Block a user