Skip to content

Commit

Permalink
Feat(cli): Finished all functionalities
Browse files Browse the repository at this point in the history
- passed all tests
  • Loading branch information
minhtrannhat committed Sep 2, 2023
1 parent d401122 commit 3402ac5
Show file tree
Hide file tree
Showing 8 changed files with 336 additions and 33 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ name: Rust

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run pre tests
run: ./mk-outs.sh
- name: Run tests
run: cargo test --verbose
208 changes: 208 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ clap = { version = "4", features = ["cargo", "help"] }
assert_cmd = "2.0.12"
predicates = "3.0.3"
rand = "0.8.5"
rstest = "0.18.1"
29 changes: 29 additions & 0 deletions mk-outs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -u

ROOT="tests/inputs"
OUT_DIR="tests/expected"

[[ ! -d "$OUT_DIR" ]] && mkdir -p "$OUT_DIR"

EMPTY="$ROOT/empty.txt"
FOX="$ROOT/fox.txt"
SPIDERS="$ROOT/spiders.txt"
BUSTLE="$ROOT/the-bustle.txt"
ALL="$EMPTY $FOX $SPIDERS $BUSTLE"

for FILE in $ALL; do
BASENAME=$(basename "$FILE")
cat $FILE > ${OUT_DIR}/${BASENAME}.out
cat -n $FILE > ${OUT_DIR}/${BASENAME}.n.out
cat -b $FILE > ${OUT_DIR}/${BASENAME}.b.out
done

cat $ALL > $OUT_DIR/all.out
cat -n $ALL > $OUT_DIR/all.n.out
cat -b $ALL > $OUT_DIR/all.b.out

cat < $BUSTLE > $OUT_DIR/$(basename $BUSTLE).stdin.out
cat -n < $BUSTLE > $OUT_DIR/$(basename $BUSTLE).n.stdin.out
cat -b < $BUSTLE > $OUT_DIR/$(basename $BUSTLE).b.stdin.out
Loading

0 comments on commit 3402ac5

Please sign in to comment.