1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-03 04:34:21 -05:00

Add a number of simple ref-tests

Also adds a feature `err-println` for enabling `err_println!` printing.
This commit is contained in:
Joe Wilm 2016-11-19 18:12:04 -08:00
parent 66dbd29cd1
commit 0dfba30181
13 changed files with 271 additions and 16 deletions

View file

@ -9,7 +9,7 @@ os:
rust:
# Whole bunch of stuff needs nightly for now
- nightly-2016-07-11
- nightly-2016-11-06
script:
- cargo test
- cargo test --no-default-features

View file

@ -27,9 +27,10 @@ serde_json = "*"
copypasta = { path = "./copypasta" }
[features]
default = []
default = ["err-println"]
# Enabling this feature makes shaders automatically reload when changed
live-shader-reload = []
err-println = []
[build-dependencies]
gl_generator = "0.5"

View file

@ -23,16 +23,10 @@ macro_rules! die {
#[macro_export]
macro_rules! err_println {
($($arg:tt)*) => {{
use std::io::Write;
(writeln!(&mut ::std::io::stderr(), $($arg)*)).expect("stderr");
}}
}
#[macro_export]
macro_rules! err_println {
($($arg:tt)*) => {{
use std::io::Write;
(writeln!(&mut ::std::io::stderr(), $($arg)*)).expect("stderr");
if cfg!(feature = "err-println") {
use std::io::Write;
(writeln!(&mut ::std::io::stderr(), $($arg)*)).expect("stderr");
}
}}
}

View file

@ -69,10 +69,15 @@ mod reference {
($( $name:ident ),*) => {
$(
ref_test! { $name }
),*
}
)*
};
}
// Ref tests!
ref_test! { ll }
ref_test! {
ll,
vim_simple_edit,
tmux_htop,
tmux_git_log
}
}

View file

@ -0,0 +1,124 @@
% jwilm@kurast.local ➜  ~/code/alacritty  [?1h=[?2004hggigit log[?1l>[?2004l
[?1049h[?1h= commit bdd21810882dbba8485ac44c871482dfc6ea9b93
Author: Joe Wilm <joe@jwilm.com>
Date: Sat Nov 19 16:16:20 2016 -0800

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. I think this still
:  needs to be done for linux.
:  * 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`.
: 
: commit d97996e19de6856c23c51d05ec10f10db41e309d
: Author: Joe Wilm <joe@jwilm.com>
: [?1l>[?1049l% jwilm@kurast.local ➜  ~/code/alacritty  [?1h=[?2004httmtmutmux[?1l>[?2004l
[?1049h(B[?1l>[?12l[?25h[?1000l[?1002l[?1006l[?1005l]112[?25l






















1:reattach-to-user-namespace* (B[?12l[?25hg[?25l1:zsh* (B[?12l[?25h%(B 


jwilm@kurast.local ➜ ~/code/alacritty (B [?1h=[?2004hg(Bgi(Bgit(B lg[?1l>
[?2004l[?25l





















[?12l[?25h[?1h=* bdd2181(B - (2 hours ago)(B Add support for recording/running ref tests - Joe Wilm(B  (HEAD -> ref-tests, origin/ref-tests)
(B| * d629f72(B - (2 days ago)(B WIP on master: d97996e Make bindings configurable f rom alacritty.yml - Joe Wilm(B (refs/stash)
(B| |\
|/ /
|(B * 5908bde(B - (2 days ago)(B index on master: d97996e Make bindings configurable f rom alacritty.yml - Joe Wilm
(B|/
* d97996e(B - (4 days (Bago)(B Make bindings configurable from alacritty.yml - Joe Wil(B m(B (o(Brigin/master, origin/bindings-v2, origin/HEAD, master, bindings-v2)
(B* cb2bc4e(B - (4 days ago)(B Fix test for Cell layout - Joe Wilm
(B* cbb9167(B - (5 days ago)(B Redraw screen on focus - Joe Wilm
(B* 8360ab4(B - (8 days ago)(B Fallback to received chars when no bindings - Joe Wilm
(B* 6925daa(B - (8 days ago)(B Fix/add some keybindings - Jo(Be Wilm
(B* e426013(B - (8 days ago)(B Fix alacritty shutdown when shell exits on macOS - Joe (B Wilm
(B* 8cbd768(B - (8 days ago)(B Fix resize on macOS leaving screen blank - Joe Wilm
(B* a652b4a(B - (8 days ago)(B Rustup - Joe Wilm
(B* 3e0b2b6(B - (8 days ago)(B Fix config file reloading on macOS - (BJoe Wilm
(B* be036ed(B - (8 days ago)(B Workaround for cutoff glyphs - Joe Wilm(B
* 82c8804(B - (3 weeks ago)(B Update default config - Joe Wilm(B
:[?25l
1:git* (B[?12l[?25h * a81152c(B - (3 weeks ago)(B Support drawing bold test with bright colors - Joe Wil(B : m(B
: * 7cd8a6c(B - (3 weeks ago)(B Merge branch 'reload-colors' - Joe Wilm(B
: |\
: | * f8cb6d4(B - (3 weeks ago)(B Set colors on CPU - Joe Wilm(B
: | * cb2fa27(B - (3 weeks ago)(B Dynamically update render_timer config - Joe Wilm(B
: | * 06ea6c8(B - (3 weeks ago)(B Move config reloading to separate thread - Joe Wilm(B
: | * 0958c0f(B - (4 weeks ago)(B Move color indexing to vertex shader - Joe Wilm(B
: | * e9304af(B - (4 weeks ago)(B Expand cell::Color layout tests - Joe Wilm(B
: | * 741a8b3(B - (4 weeks ago)(B Fix some compiler warnings - Joe Wilm(B
: | * b29eed2(B - (4 weeks ago)(B Add discriminant_value test for cell::Color - Joe Wi(Bi(B : lm(B
: | * 5876b4b(B - (4 weeks ago)(B Proof of concept live reloading for colors - Joe Wil(Bl(B : m(B
: * | e503baf(B - (3 weeks ago)(B Live shader reloading is now a feature - Joe Wilm(B
: |/
: | * 655e8f4(B - (4 weeks ago)(B WIP color management - Joe Wilm(B (live-reload-(Bcolors)(B
: |/
: * ea07f03(B - (5 weeks ago)(B Add test exhibiting SIGBUS on my machine - Joe Wilm(B
: M* a652b4a(B - (8 days ago)(B Rustup - Joe Wilm(B: M* 8cbd768(B - (8 days ago)(B Fix resize on macOS leaving screen blank - Joe Wilm(B: MWilm(B: M* e426013(B - (8 days ago)(B Fix alacritty shutdown when shell exits on macOS - Joe (B: M* 6925daa(B - (8 days ago)(B Fix/add some keybindings - Joe Wilm(B: M* 8360ab4(B - (8 days ago)(B Fallback to received chars when no bindings - Joe Wilm(B: M* cbb9167(B - (5 days ago)(B Redraw screen on focus - Joe Wilm(B: M* cb2bc4e(B - (4 days ago)(B Fix test for Cell layout - Joe Wilm(B: Mm(B (origin/master, origin/bindings-v2, origin/HEAD, master, bindings-v2)
(B: M* d97996e(B - (4 days ago)(B Make bindings configurable from alacritty.yml - Joe Wil(B: M|/ : Mrom alacritty.yml - Joe Wilm(B: M| * 5908bde(B - (2 days ago)(B index on master: d97996e Make bindings configurable f: M|/ / : M| |\ : Mrom alacritty.yml - Joe Wilm(B (refs/stash)(B: M| * d629f72(B - (2 days ago)(B WIP on master: d97996e Make bindings configurable f: M (HEAD -> ref-tests, origin/ref-tests)(B: M* bdd2181(B - (2 hours ago)(B Add support for recording/running ref tests - Joe Wilm(B: : : : : : : : : : : : :

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"width":1124.0,"height":628.0,"cell_width":14.0,"cell_height":26.0}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"width":1124.0,"height":628.0,"cell_width":14.0,"cell_height":26.0}

View file

@ -0,0 +1,7 @@
% jwilm@kurast.local ➜  ~/code/alacritty  [?1h=[?2004hvvivim[?1l>[?2004l
[?1049h[?1h=▽ [?12;25h[?12l[?25h[>c[?25l 1
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 0,0-1AllVIM - Vi IMprovedversion 7.4.1832by Bram Moolenaar et al.Vim is open source and freely distributableHelp poor children in Uganda!type :help iccf<Enter> for information type :q<Enter> to exit type :help<Enter> or <F1> for on-line helptype :help version7<Enter> for version info[?12l[?25h[?25l-- INSERT --0,1All         [?12l[?25h[?25lu1,2[?12l[?25h[?25ls3[?12l[?25h[?25le4[?12l[?25h[?25l·5[?12l[?25h[?25l s6[?12l[?25h[?25lt7[?12l[?25h[?25ld8[?12l[?25h[?25l:9[?12l[?25h[?25l:10[?12l[?25h[?25lf1[?12l[?25h[?25ls2[?12l[?25h[?25l;3[?12l[?25h[?25l
 2 2,1 [?12l[?25h[?25l
 3 3[?12l[?25h[?25lf2[?12l[?25h[?25ln3[?12l[?25h[?25l·4[?12l[?25h[?25l m5[?12l[?25h[?25la6[?12l[?25h[?25li7[?12l[?25h[?25ln8[?12l[?25h[?25l(9[?12l[?25h[?25l)8[?12l[?25h[?25l()·11[?12l[?25h[?25l {2[?12l[?25h[?25l
 4 ···· 4,5 [?12l[?25h[?25l
 5 ···· 5[?12l[?25h[?25l }3,11[?12l[?25h[?25l} -- INSERT --5,2All[?12l[?25h[?25l{}5,1All[?12l[?25h[?25l:[?12l[?25hs[?25l[?12l[?25he[?25l[?12l[?25ht[?25l[?12l[?25h[?25l [?12l[?25hf[?25l[?12l[?25ht[?25l[?12l[?25h=[?25l[?12l[?25hr[?25l[?12l[?25hu[?25l[?12l[?25hs[?25l[?12l[?25ht[?25l[?12l[?25h [?25luse std::fn main5,1All[?12l[?25h

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"width":1124.0,"height":628.0,"cell_width":14.0,"cell_height":26.0}