Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: optimize build script #333

Merged
merged 2 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ jobs:

- uses: Swatinem/rust-cache@v2

- name: Install Bash 5 on macOS
if: runner.os == 'macOS'
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install bash
bash --version

- name: Test
run: cargo test --all

Expand Down
4 changes: 3 additions & 1 deletion src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ _argc_require_params() {
r#"
_argc_validate_choices() {
local render_name="$1" raw_choices="$2" choices item choice concated_choices=""
IFS=$'\n' read -r -d '' -a choices <<<"$raw_choices" || true
while IFS= read -r line; do
choices+=("$line")
done <<<"$raw_choices"
for choice in "${choices[@]}"; do
if [[ -z "$concated_choices" ]]; then
concated_choices="$choice"
Expand Down
32 changes: 16 additions & 16 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,22 @@ fn run_build() {
.assert()
.success();

// Command::cargo_bin("argc")
// .unwrap()
// .arg("--argc-run")
// .arg(&outpath)
// .args([
// "--fa",
// "--oa",
// "oa1",
// "--of=of1,of2",
// "--oca=a",
// "--ofa",
// "abc",
// ])
// .assert()
// .stdout(predicates::str::contains("argc__fn=main"))
// .success();
Command::cargo_bin("argc")
.unwrap()
.arg("--argc-run")
.arg(&outpath)
.args([
"--fa",
"--oa",
"oa1",
"--of=of1,of2",
"--oca=a",
"--ofa",
"abc",
])
.assert()
.stdout(predicates::str::contains("argc__fn=main"))
.success();
}

#[test]
Expand Down