Skip to content

Commit

Permalink
replace CRLF
Browse files Browse the repository at this point in the history
  • Loading branch information
bwireman committed Dec 31, 2024
1 parent 1678268 commit 58dc32c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
version: 1.2.5
title: Manifest test: test/testdata/manifest/dos.toml
---
[
Package(
"a",
SemVer(0, 8, 1, "", ""),
"0.8.1",
True,
),
Package(
"dos",
SemVer(2, 2, 123, "", ""),
"2.2.123",
False,
),
]
7 changes: 4 additions & 3 deletions src/go_over/packages.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ pub type Package {
}

pub fn read_manifest(path: String) -> List(Package) {
let res = simplifile.read(path) |> hard_fail("could not parse " <> path)

let cleaned = string.replace(res, "\r", "")
let res =
simplifile.read(path)
|> hard_fail("could not parse " <> path)
let cleaned = string.replace(res, "\r\n", "\n")

let manifest = tom.parse(cleaned) |> hard_fail("could not parse " <> path)

Expand Down
5 changes: 5 additions & 0 deletions test/manifest_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ pub fn read_manifest_test() {
should.equal(b.name, "b")
should.equal(b.version_raw, "2.2.123")
should.be_false(b.direct)

let assert [_, dos] = test_read_manifest("test/testdata/manifest/dos.toml")
should.equal(dos.name, "dos")
should.equal(dos.version_raw, "2.2.123")
should.be_false(dos.direct)
}
3 changes: 3 additions & 0 deletions test/testdata/manifest/b.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file was generated by Gleam
# You typically do not need to edit this file

packages = [
{ name = "a", version = "0.8.1", build_tools = ["gleam"], requirements = ["b"], otp_app = "a", source = "hex", outer_checksum = "DEADBEEF" },
{ name = "b", version = "2.2.123", build_tools = ["gleam"], requirements = [], otp_app = "b", source = "hex", outer_checksum = "DEADBEEF" },
Expand Down
10 changes: 10 additions & 0 deletions test/testdata/manifest/dos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file was generated by Gleam
# You typically do not need to edit this file

packages = [
{ name = "a", version = "0.8.1", build_tools = ["gleam"], requirements = ["dos"], otp_app = "a", source = "hex", outer_checksum = "DEADBEEF" },
{ name = "dos", version = "2.2.123", build_tools = ["gleam"], requirements = [], otp_app = "dos", source = "hex", outer_checksum = "DEADBEEF" },
]

[requirements]
a = { version = ">= 0.10.0 and < 1.0.0" }

0 comments on commit 58dc32c

Please sign in to comment.