Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/NonlinearFruit/advent-of-code-2023
Using thematic puzzles to TDD in Nushell
https://github.com/NonlinearFruit/advent-of-code-2023
advent-of-code advent-of-code-2023 nushell tdd
Last synced: 6 days ago
JSON representation
Using thematic puzzles to TDD in Nushell
- Host: GitHub
- URL: https://github.com/NonlinearFruit/advent-of-code-2023
- Owner: NonlinearFruit
- Archived: true
- Created: 2023-12-01T17:00:34.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2023-12-22T20:00:50.000Z (7 months ago)
- Last Synced: 2024-03-11T13:31:00.311Z (4 months ago)
- Topics: advent-of-code, advent-of-code-2023, nushell, tdd
- Language: Nushell
- Homepage: https://adventofcode.com/
- Size: 51.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-advent-of-code - NonlinearFruit/advent-of-code-2023 - 2023--12--22-brightgreen) (2023 / Solutions)
README
# Advent of Code 2023
[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/NonlinearFruit/advent-of-code-2023/master)](https://github.com/NonlinearFruit/advent-of-code-2023/commits/master/)
[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/NonlinearFruit/advent-of-code-2023/test.yml?label=tests)](https://github.com/NonlinearFruit/advent-of-code-2023/actions/workflows/test.yml)
![star count](https://img.shields.io/badge/stars-7-yellow)
![test count](https://img.shields.io/badge/tests-99-blue)```
* 13
* 12
* 11
* 10
* 9
* 8
* . ' ' . 7
* 6
' '
~ * 5
...''''' .''.~ '
.'' . ~..'* '. ~ . 4 *
.' '''../......'''
: /\ -/ :
'. - - / .'
'.. - - *..' 3 **
----@ '''..*......''' 2 **
* ! /^\ 1 **
```# Prerequisites
```
cargo install nushell # https://github.com/nushell/nushell
cargo install aoc-cli # https://github.com/scarvalhojr/aoc-cli
vim ~/.adventofcode.session # https://github.com/scarvalhojr/aoc-cli?tab=readme-ov-file#session-cookie-
```# Usage
nu -c 'use ci; ci debug day'
```
Debugs the given dayUsage:
> debug dayFlags:
-h, --help - Display the help message for this commandParameters:
day :Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯```
nu -c 'use ci; ci pull puzzle'
```
Download the puzzle input and descriptionUsage:
> pull puzzle (day)Flags:
-h, --help - Display the help message for this commandParameters:
day : (optional)Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯```
nu -c 'use ci; ci run puzzle'
```
Run a puzzle solverUsage:
> run puzzle (day)Flags:
-h, --help - Display the help message for this commandParameters:
day : (optional)Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯```
nu -c 'use ci; ci submit answer'
```
Submit an answer to a puzzleUsage:
> submit answer (day)Flags:
-h, --help - Display the help message for this commandParameters:
day : (optional)Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯```
nu -c 'use ci; ci test'
```
Runs all the unit testsUsage:
> testSubcommands:
test day - Runs all the unit tests for a single dayFlags:
-h, --help - Display the help message for this commandInput/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯```
nu -c 'use ci; ci test day'
```
Runs all the unit tests for a single dayUsage:
> test dayFlags:
-h, --help - Display the help message for this commandParameters:
day :Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯```
nu -c 'use ci; ci update readme'
```
Recalculate the READMEUsage:
> update readmeFlags:
-h, --help - Display the help message for this commandInput/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯```
## Nushell v0.87.1: Lessons Learned
- Test result summary (eg: `Failed: 0 Passed: 50 Skipped: 5`)
- Printing test name _with_ the test error
- Printing filename + line + column with error
- Parameterized tests
- Nesting tests (eg: `describe`)
- Find regex matches in string with their corresponding index in the string (eg: 'day-3')
- Version specific documentation (eg: `v0.85.0` vs `v0.87.1`)
- Unexpected errors 'assert index wrong' that show the internal interpreter error and not the source code issue
- Unexpected errors 'to noun' that show the internal interpreter error and not the source code issue
- `can't convert list to NUON`
- Unexpected white space dependent syntax (eg: `1+1` vs `1 + 1`)
- `run-tests` should output structured data (eg: test name, status, execution time, etc)
- String interpolation parsing has unexpected behavior
- Double quote allows escaping `(` and singles don't
- `$var | get field` works at times when `$var.field` feels like it should but doesn't
- Negative asserts (eg: `assert not equal` or `assert does not contain`)
- Navigating through an element in an array doesn't work as expected (eg: `$questions.Data.$number.Proofs.References` fails, `$questions.Data | get $number | get Proofs.References` works)