mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 20:32:15 +00:00
commit
820e796fd8
39
.github/workflows/jq.yml
vendored
Normal file
39
.github/workflows/jq.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: jq
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- jq/*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-jq-translation:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Rust Toolchain
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
profile: minimal
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
|
||||||
|
# TODO: this step takes ~2m, consider using https://github.com/marketplace/actions/cargo-install
|
||||||
|
- name: Install jaq
|
||||||
|
run: |
|
||||||
|
cargo install --locked --git https://github.com/01mf02/jaq
|
||||||
|
|
||||||
|
- name: Expect unit test to fail
|
||||||
|
working-directory: jq
|
||||||
|
run: |
|
||||||
|
! ./test-gilded-rose.sh
|
||||||
|
|
||||||
|
- name: Expect texttest fixture output (aka 'verify')
|
||||||
|
working-directory: jq
|
||||||
|
run: |
|
||||||
|
jaq --arg days 31 -nr "$(cat gilded-rose.jq) $(cat texttest_fixture.jq)" |
|
||||||
|
diff - ../texttests/ThirtyDays/stdout.gr
|
||||||
@ -5,7 +5,7 @@
|
|||||||
{ name: "Aged Brie", sell_in: 2, quality: 0 },
|
{ name: "Aged Brie", sell_in: 2, quality: 0 },
|
||||||
{ name: "Elixir of the Mongoose", sell_in: 5, quality: 7 },
|
{ name: "Elixir of the Mongoose", sell_in: 5, quality: 7 },
|
||||||
{ name: "Sulfuras, Hand of Ragnaros", sell_in: 0, quality: 80 },
|
{ name: "Sulfuras, Hand of Ragnaros", sell_in: 0, quality: 80 },
|
||||||
{ name: "Sulfuras, Hand of Ragnaros", sell_in: 1, quality: 80 },
|
{ name: "Sulfuras, Hand of Ragnaros", sell_in: -1, quality: 80 },
|
||||||
{ name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 15, quality: 20 },
|
{ name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 15, quality: 20 },
|
||||||
{ name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 10, quality: 49 },
|
{ name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 10, quality: 49 },
|
||||||
{ name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 5, quality: 49 },
|
{ name: "Backstage passes to a TAFKAL80ETC concert", sell_in: 5, quality: 49 },
|
||||||
@ -14,9 +14,9 @@
|
|||||||
{ items: ., day: 0 } |
|
{ items: ., day: 0 } |
|
||||||
recurse(.day += 1 | .items = (.items | update_quality); .day < ($ARGS.named.days // 2 | tonumber)) |
|
recurse(.day += 1 | .items = (.items | update_quality); .day < ($ARGS.named.days // 2 | tonumber)) |
|
||||||
(
|
(
|
||||||
"",
|
|
||||||
(["-------- day ", (.day | tostring), " --------"] | add),
|
(["-------- day ", (.day | tostring), " --------"] | add),
|
||||||
("name, sellIn, quality"),
|
("name, sellIn, quality"),
|
||||||
(.items[] | [.name, .sell_in, .quality | tostring] | join(", "))
|
(.items[] | [.name, .sell_in, .quality | tostring] | join(", ")),
|
||||||
|
""
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user