🐦‍⬛ Snapshot testing in Gleam

:bookmark: Version 1.1.7

+1 -10
.github/workflows/release.yml
··· 12 12 - uses: erlef/setup-beam@v1 13 13 with: 14 14 otp-version: "26.0.2" 15 - gleam-version: "1.1.0" 15 + gleam-version: "1.2.1" 16 16 rebar3-version: "3" 17 - 18 - - run: cargo install tomlq 19 - - run: | 20 - if [ "v$(tomlq version -f gleam.toml)" == "${{ github.ref_name }}" ]; then 21 - exit 0 22 - fi 23 - echo "tag does not match version in gleam.toml, refusing to publish" 24 - exit 1 25 - 26 17 - run: gleam format --check src test 27 18 - run: gleam test --target erlang 28 19 - run: gleam publish -y
+1 -1
.github/workflows/test.yml
··· 15 15 - uses: erlef/setup-beam@v1 16 16 with: 17 17 otp-version: "26.0.2" 18 - gleam-version: "1.1.0" 18 + gleam-version: "1.2.1" 19 19 rebar3-version: "3" 20 20 - run: gleam deps download 21 21 - run: gleam test --target=erlang
+4
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 + ## v1.1.7 - 2024-05-28 4 + 5 + - ⬆️ Update `simplifile` to `>= 2.0.1 and < 3.0.0` 6 + 3 7 ## v1.1.6 - 2024-05-28 4 8 5 9 - ⬆️ Change dependencies contraints
+1 -1
birdie_snapshots/can_find_literal_titles_when_calling_`birdie_snap`.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: can find literal titles when calling `birdie.snap` 4 4 file: ./test/titles_test.gleam 5 5 test_name: can_find_literal_titles_when_calling_birdie_snap_test
+1 -1
birdie_snapshots/can_find_literal_titles_when_calling_`snap`.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: can find literal titles when calling `snap` 4 4 file: ./test/titles_test.gleam 5 5 test_name: can_find_literal_titles_when_calling_snap_test
+1 -1
birdie_snapshots/can_find_literal_titles_when_calling_aliased_`b_snap`.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: can find literal titles when calling aliased `b.snap` 4 4 file: ./test/titles_test.gleam 5 5 test_name: can_find_literal_titles_when_calling_aliased_birdie_snap_test
+1 -1
birdie_snapshots/can_find_literal_titles_when_calling_aliased_`s`.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: can find literal titles when calling aliased `s` 4 4 file: ./test/titles_test.gleam 5 5 test_name: can_find_literal_titles_when_calling_aliased_snap_test
+1 -1
birdie_snapshots/can_find_literal_titles_when_calling_aliased_discarded_module.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: can find literal titles when calling aliased discarded module 4 4 file: ./test/titles_test.gleam 5 5 test_name: can_find_literal_titles_when_calling_aliased_discarded_module_test
+1 -1
birdie_snapshots/can_find_literal_titles_when_calling_discarded_module.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: can find literal titles when calling discarded module 4 4 file: ./test/titles_test.gleam 5 5 test_name: can_find_literal_titles_when_calling_discarded_module_test
+1 -1
birdie_snapshots/can_read_the_snap_titles_from_the_project_itself.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: can read the snap titles from the project itself 4 4 file: ./test/titles_test.gleam 5 5 test_name: can_read_the_snap_titles_from_the_project_itself_test
+1 -1
birdie_snapshots/diffing_a_case_expression.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: diffing a case expression 4 4 file: ./test/birdie_test.gleam 5 5 test_name: complex_function_test
+1 -1
birdie_snapshots/my_favourite_number_wrapped_in_a_result.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: my favourite number wrapped in a result 4 4 file: ./test/birdie_test.gleam 5 5 test_name: a_result_test
+1 -1
birdie_snapshots/my_first_snapshot.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: my first snapshot 4 4 file: ./test/birdie_test.gleam 5 5 test_name: hello_birdie_test
+1 -1
birdie_snapshots/snapping_a_list_of_numbers.accepted
··· 1 1 --- 2 - version: 1.1.6 2 + version: 1.1.7 3 3 title: snapping a list of numbers 4 4 file: ./test/birdie_test.gleam 5 5 test_name: list_test
+1 -1
gleam.toml
··· 1 1 name = "birdie" 2 - version = "1.1.6" 2 + version = "1.1.7" 3 3 4 4 description = "Snapshot testing in Gleam" 5 5 licences = ["Apache-2.0"]
+1 -1
src/birdie.gleam
··· 16 16 import rank 17 17 import simplifile 18 18 19 - const birdie_version = "1.1.6" 19 + const birdie_version = "1.1.7" 20 20 21 21 const birdie_snapshots_folder = "birdie_snapshots" 22 22
+5 -4
src/birdie/internal/diff.gleam
··· 53 53 54 54 // While the second list has lines that are not in common we add those 55 55 // marking them as new. 56 - [first_common, ..], one, [first_other, ..other] if first_common 57 - != first_other -> 56 + [first_common, ..], one, [first_other, ..other] 57 + if first_common != first_other 58 + -> 58 59 [DiffLine(line_other, first_other, New), ..lines] 59 60 |> match_diff_lines(lcs, line_one, one, line_other + 1, other) 60 61 ··· 176 177 Other(n, _, _), Other(m, before, after) -> Other(n + m, before, after) 177 178 178 179 One(n, before_one, after_one), Other(m, before_other, after_other) 179 - | Both(n, before_one, after_one, _, _), Other(m, before_other, after_other) -> 180 - Both(n + m, before_one, after_one, before_other, after_other) 180 + | Both(n, before_one, after_one, _, _), Other(m, before_other, after_other) 181 + -> Both(n + m, before_one, after_one, before_other, after_other) 181 182 182 183 _, _ -> panic as "unreachable: sum_occurrences" 183 184 }