From 81b45ed178d6520116c4cd23106433b00aaa8ee4 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 12 Nov 2024 13:57:46 +0100 Subject: [PATCH] Add `hello-world` exercise (#4) --- .github/workflows/test.yml | 8 ++++++-- bin/verify-exercises | 17 ++--------------- config.json | 12 ++++++++++++ exercises/practice/.keep | 0 .../hello-world/.docs/instructions.md | 16 ++++++++++++++++ .../practice/hello-world/.meta/config.json | 19 +++++++++++++++++++ .../practice/hello-world/.meta/example.ua | 1 + .../practice/hello-world/.meta/tests.toml | 13 +++++++++++++ exercises/practice/hello-world/hello-world.ua | 1 + exercises/practice/hello-world/tests.ua | 3 +++ 10 files changed, 73 insertions(+), 17 deletions(-) delete mode 100644 exercises/practice/.keep create mode 100644 exercises/practice/hello-world/.docs/instructions.md create mode 100644 exercises/practice/hello-world/.meta/config.json create mode 100644 exercises/practice/hello-world/.meta/example.ua create mode 100644 exercises/practice/hello-world/.meta/tests.toml create mode 100644 exercises/practice/hello-world/hello-world.ua create mode 100644 exercises/practice/hello-world/tests.ua diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a33abc3..2780893 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,8 +20,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Install uiua - run: gh release download 0.13.0 --repo uiua-lang/uiua --dir /usr/local/bin --pattern uiua-bin-x86_64-unk -nown-linux-gnu-no-audio.zip + run: | + gh release download 0.13.0 --repo uiua-lang/uiua --pattern uiua-bin-x86_64-unknown-linux-gnu-no-audio.zip --output uiua.zip + unzip uiua.zip + echo "${PWD}" >> "${GITHUB_PATH}" + env: + GH_TOKEN: ${{ github.token }} - name: Verify all exercises run: bin/verify-exercises diff --git a/bin/verify-exercises b/bin/verify-exercises index 01722ef..3658eba 100755 --- a/bin/verify-exercises +++ b/bin/verify-exercises @@ -31,25 +31,12 @@ copy_example_or_examplar_to_solution() { unskip_tests() { jq -r '.files.test[]' .meta/config.json | while read -r test_file; do - noop # TODO: replace this with the command to unskip the tests. - # Note: this function runs from within an exercise directory. - # Note: the exercise directory is a temporary directory, so feel - # free to modify its (test) files as needed. - # Note: ignore this function if either: - # - skipping tests is not supported, or - # - skipping tests does not require modifying the test files. - # Example: sed -i 's/test.skip/test/g' "${test_file}" + : # TODO: unskip tests one we've come up with a nice way to do so done } run_tests() { - noop # TODO: replace this with the command to run the tests for the exercise. - # Note: this function runs from within an exercise directory. - # Note: the exercise directory is a temporary directory, so feel - # free to modify its files as needed. - # Note: return a zero exit code if all tests pass, otherwise non-zero. - # Example: `npm test` - # Example: `python3 -m pytest two_fer_test.py` + uiua tests.ua } verify_exercise() { diff --git a/config.json b/config.json index 6e14c20..cfa1c8c 100644 --- a/config.json +++ b/config.json @@ -28,6 +28,18 @@ ".meta/exemplar.ua" ] }, + "exercises": { + "practice": [ + { + "slug": "hello-world", + "name": "Hello World", + "uuid": "46a9d758-fc46-408f-b31b-7dd4e33e3fbd", + "practices": [], + "prerequisites": [], + "difficulty": 1 + } + ] + }, "tags": [ "execution_mode/interpreted", "paradigm/array", diff --git a/exercises/practice/.keep b/exercises/practice/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/exercises/practice/hello-world/.docs/instructions.md b/exercises/practice/hello-world/.docs/instructions.md new file mode 100644 index 0000000..c9570e4 --- /dev/null +++ b/exercises/practice/hello-world/.docs/instructions.md @@ -0,0 +1,16 @@ +# Instructions + +The classical introductory exercise. +Just say "Hello, World!". + +["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment. + +The objectives are simple: + +- Modify the provided code so that it produces the string "Hello, World!". +- Run the test suite and make sure that it succeeds. +- Submit your solution and check it at the website. + +If everything goes well, you will be ready to fetch your first real exercise. + +[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program diff --git a/exercises/practice/hello-world/.meta/config.json b/exercises/practice/hello-world/.meta/config.json new file mode 100644 index 0000000..d83a46f --- /dev/null +++ b/exercises/practice/hello-world/.meta/config.json @@ -0,0 +1,19 @@ +{ + "authors": [ + "erikschierboom" + ], + "files": { + "solution": [ + "hello-world.ua" + ], + "test": [ + "tests.ua" + ], + "example": [ + ".meta/example.ua" + ] + }, + "blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".", + "source": "This is an exercise to introduce users to using Exercism", + "source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program" +} diff --git a/exercises/practice/hello-world/.meta/example.ua b/exercises/practice/hello-world/.meta/example.ua new file mode 100644 index 0000000..9d4babd --- /dev/null +++ b/exercises/practice/hello-world/.meta/example.ua @@ -0,0 +1 @@ +Hello ← |0 "Hello, World!" diff --git a/exercises/practice/hello-world/.meta/tests.toml b/exercises/practice/hello-world/.meta/tests.toml new file mode 100644 index 0000000..73466d6 --- /dev/null +++ b/exercises/practice/hello-world/.meta/tests.toml @@ -0,0 +1,13 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[af9ffe10-dc13-42d8-a742-e7bdafac449d] +description = "Say Hi!" diff --git a/exercises/practice/hello-world/hello-world.ua b/exercises/practice/hello-world/hello-world.ua new file mode 100644 index 0000000..33ae450 --- /dev/null +++ b/exercises/practice/hello-world/hello-world.ua @@ -0,0 +1 @@ +Hello ← |0 "Goodbye, Mars!" diff --git a/exercises/practice/hello-world/tests.ua b/exercises/practice/hello-world/tests.ua new file mode 100644 index 0000000..da981e2 --- /dev/null +++ b/exercises/practice/hello-world/tests.ua @@ -0,0 +1,3 @@ +~ "hello-world.ua" ~ Hello + +⍤⤙≍ "Hello, World!" Hello