mirror of
https://github.com/alacritty/alacritty.git
synced 2025-10-30 23:36:53 -04:00
Add support for recording/running ref tests
Ref tests use a recording of the terminal protocol and a serialization of the grid state to check that the parsing and action handling systems produce the correct result. Ref tests may be recorded by running alacritty with `--ref-test` and closing the terminal by using the window "X" button. At that point, the recording is fully written to disk, and a serialization of important state is recorded. Those files should be moved to an appropriate folder in the `tests/ref/` tree, and the `ref_test!` macro invocation should be updated accordingly. A couple of changes were necessary to make this work: * Ref tests shouldn't create a pty; the pty was refactored out of the `Term` type. * Repeatable lines/cols were needed; on startup, the terminal is resized * by default to 80x24 though that may be changed by passing `--dimensions w h`. * Calculating window size based on desired rows/columns and font metrics required making load_font callable multiple times. * Refactor types into library crate so they may be imported in an integration test. * A whole bunch of types needed symmetric serialization and deserialization. Mostly this was just adding derives, but the custom deserialization of Rgb had to change to a deserialize_with function. This initially adds one ref test as a sanity check, and more will be added in subsequent commits. This initial ref tests just starts the terminal and runs `ll`.
This commit is contained in:
parent
d97996e19d
commit
66dbd29cd1
21 changed files with 448 additions and 163 deletions
27
tests/ref/ll/alacritty.recording
Normal file
27
tests/ref/ll/alacritty.recording
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
[1m[7m%[27m[1m[0m
[0m[27m[24m[Jjwilm@kurast.local [01;32m➜ [01;32m [36m~/code/alacritty [00m [K[?1h=[?2004h[35ml[39m[35ml[35ml[39m[?1l>[?2004l
|
||||
total 16440
|
||||
drwxr-xr-x 3 jwilm staff 102B Nov 2 10:54 [1m[36mAlacritty.app[39;49m[0m
|
||||
-rw-r--r-- 1 jwilm staff 53K Nov 19 14:27 Cargo.lock
|
||||
-rw-r--r-- 1 jwilm staff 746B Nov 19 14:24 Cargo.toml
|
||||
-rw-r--r-- 1 jwilm staff 11K Jun 30 10:44 LICENSE-APACHE
|
||||
-rw-r--r-- 1 jwilm staff 1.6K Nov 2 10:52 Makefile
|
||||
-rw-r--r-- 1 jwilm staff 49B Jun 9 18:56 TASKS.md
|
||||
-rwxr-xr-x 1 jwilm staff 1.7M Sep 26 10:49 [31malacritty-pre-eloop[39;49m[0m
|
||||
-rw-r--r-- 1 jwilm staff 255B Nov 19 14:31 alacritty.recording
|
||||
-rw-r--r-- 1 jwilm staff 6.5K Nov 17 17:18 alacritty.yml
|
||||
-rw-r--r-- 1 jwilm staff 1.1K Jun 30 10:44 build.rs
|
||||
drwxr-xr-x 6 jwilm staff 204B Oct 10 10:46 [1m[36mcopypasta[39;49m[0m
|
||||
drwxr-xr-x 3 jwilm staff 102B Jun 9 18:56 [1m[36mdocs[39;49m[0m
|
||||
-rwxr-xr-x 1 jwilm staff 2.2M Nov 11 17:53 [31mexitter[39;49m[0m
|
||||
drwxr-xr-x 5 jwilm staff 170B Jun 28 14:50 [1m[36mfont[39;49m[0m
|
||||
-rwxr-xr-x 1 jwilm staff 2.2M Nov 14 13:27 [31mhardcoded_bindings_alacritty[39;49m[0m
|
||||
drwxr-xr-x 6 jwilm staff 204B Nov 2 10:54 [1m[36mmacos[39;49m[0m
|
||||
drwxr-xr-x 4 jwilm staff 136B Oct 27 17:59 [1m[36mres[39;49m[0m
|
||||
-rw-r--r-- 1 jwilm staff 19B Nov 11 16:55 rustc-version
|
||||
drwxr-xr-x 5 jwilm staff 170B Oct 10 10:46 [1m[36mscripts[39;49m[0m
|
||||
drwxr-xr-x 17 jwilm staff 578B Nov 19 14:30 [1m[36msrc[39;49m[0m
|
||||
drwxr-xr-x 5 jwilm staff 170B Jun 28 15:49 [1m[36mtarget[39;49m[0m
|
||||
-rw-r--r-- 1 jwilm staff 8.1K Nov 17 11:13 thing.log
|
||||
-rw-r--r-- 1 jwilm staff 3.5K Sep 1 11:27 tmux-client-23038.log
|
||||
-rwxr-xr-x 1 jwilm staff 1.8M Sep 22 12:03 [31mwith_parallel[39;49m[0m
|
||||
[1m[7m%[27m[1m[0m
[0m[27m[24m[Jjwilm@kurast.local [01;32m➜ [01;32m [36m~/code/alacritty [00m [K[?1h=[?2004h
|
||||
1
tests/ref/ll/grid.json
Normal file
1
tests/ref/ll/grid.json
Normal file
File diff suppressed because one or more lines are too long
1
tests/ref/ll/size.json
Normal file
1
tests/ref/ll/size.json
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"width":1124.0,"height":628.0,"cell_width":14.0,"cell_height":26.0}
|
||||
Loading…
Add table
Add a link
Reference in a new issue