Skip to content

Commit

Permalink
tests: add new "first" key test case
Browse files Browse the repository at this point in the history
Add a test case to cover overriding the "first" key for inline tables.

Signed-off-by: Vincent Fazio <[email protected]>
  • Loading branch information
vfazio committed Nov 19, 2024
1 parent ba64498 commit 4ba1cbd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/examples/from-toml-lang.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ hosts = [
name = "Nail"
sku = 284758393
color = "gray"

[inline]
# Test "first" sorting for inline tables
c = { limit="<3.12", version ="4.12.2"}
4 changes: 4 additions & 0 deletions tests/examples/sorted/from-toml-lang-first.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ connection_max = 5000
enabled = true # Comment after a boolean
server = "192.168.1.1"

[inline]
# Test "first" sorting for inline tables
c = {version = "4.12.2", limit = "<3.12"}

[owner]
name = "Tom Preston-Werner"
dob = 1979-05-27T07:32:00Z # First class dates? Why not?
Expand Down
4 changes: 4 additions & 0 deletions tests/examples/sorted/from-toml-lang-overrides.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ enabled = true # Comment after a boolean
ports = [8001, 8001, 8002]
server = "192.168.1.1"

[inline]
# Test "first" sorting for inline tables
c = {limit = "<3.12", version = "4.12.2"}

[owner]
bio = "GitHub Cofounder & CEO\nLikes tater tots and beer."
dob = 1979-05-27T07:32:00Z # First class dates? Why not?
Expand Down
4 changes: 4 additions & 0 deletions tests/examples/sorted/from-toml-lang.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ ports = [8001, 8001, 8002]
connection_max = 5000
enabled = true # Comment after a boolean

[inline]
# Test "first" sorting for inline tables
c = {limit = "<3.12", version = "4.12.2"}

[owner]
name = "Tom Preston-Werner"
organization = "GitHub"
Expand Down
1 change: 1 addition & 0 deletions tests/test_toml_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def test_sort_toml_is_str() -> None:
"sort_config_overrides": {
"database": SortOverrideConfiguration(first=["ports"]),
"owner": SortOverrideConfiguration(first=["name", "dob"]),
"inline.c": SortOverrideConfiguration(first=["version"]),
},
},
),
Expand Down

0 comments on commit 4ba1cbd

Please sign in to comment.