Skip to content

Commit

Permalink
build.sh and install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
altsem committed Feb 11, 2024
1 parent 1497f92 commit 409d591
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,4 @@ jobs:
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose
- name: Run tests
run: |
git config --global init.defaultBranch master
cargo test --verbose
- name: Lint
run: cargo clippy
- name: Check format
run: cargo fmt --check
- name: Bench
run: cargo bench
run: ./build.sh
9 changes: 9 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

set -e

cargo build --verbose
cargo test --verbose
cargo bench --no-run
cargo clippy
cargo fmt --check
5 changes: 5 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

set -e

cargo install --path . --locked
18 changes: 11 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ mod tests {
#[test]
fn fresh_init() -> Res<()> {
let (ref mut terminal, ref mut state, dir) = setup(70, 5);
assert!(run(&dir, Command::new("git").arg("init"))?);
assert!(run(&dir, &["git", "init", "--initial-branch", "master"])?);
update(terminal, state, &[key('g')]).unwrap();
insta::assert_debug_snapshot!(terminal.backend().buffer());
Ok(())
Expand All @@ -444,8 +444,8 @@ mod tests {
#[test]
fn new_file() -> Res<()> {
let (ref mut terminal, ref mut state, dir) = setup(70, 5);
assert!(run(&dir, Command::new("git").arg("init"))?);
assert!(run(&dir, Command::new("touch").arg("new-file"))?);
assert!(run(&dir, &["git", "init", "--initial-branch", "master"])?);
assert!(run(&dir, &["touch", "new-file"])?);
update(terminal, state, &[key('g')]).unwrap();
insta::assert_debug_snapshot!(terminal.backend().buffer());
Ok(())
Expand All @@ -454,8 +454,8 @@ mod tests {
#[test]
fn stage_file() -> Res<()> {
let (ref mut terminal, ref mut state, dir) = setup(70, 5);
assert!(run(&dir, Command::new("git").arg("init"))?);
assert!(run(&dir, Command::new("touch").arg("new-file"))?);
assert!(run(&dir, &["git", "init", "--initial-branch", "master"])?);
assert!(run(&dir, &["touch", "new-file"])?);
update(terminal, state, &[key('g')]).unwrap();
insta::assert_debug_snapshot!(terminal.backend().buffer());

Expand All @@ -464,8 +464,12 @@ mod tests {
Ok(())
}

fn run(dir: &TempDir, command: &mut Command) -> Res<bool> {
Ok(command.current_dir(dir.path()).status()?.success())
fn run(dir: &TempDir, cmd: &[&str]) -> Res<bool> {
Ok(Command::new(cmd[0])
.args(&cmd[1..])
.current_dir(dir.path())
.status()?
.success())
}

fn key(char: char) -> Event {
Expand Down

0 comments on commit 409d591

Please sign in to comment.