Skip to content

Commit

Permalink
Merge pull request #182 from figsoda/escape
Browse files Browse the repository at this point in the history
fix escaping for non-toplevel attributes
  • Loading branch information
Mic92 committed Aug 6, 2023
2 parents e10a733 + fd07282 commit f56f553
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nix_update/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ class Options:
extra_flags: List[str] = field(default_factory=list)

def __post_init__(self) -> None:
self.escaped_attribute = json.dumps(self.attribute)
self.escaped_attribute = ".".join(map(json.dumps, self.attribute.split(".")))
5 changes: 3 additions & 2 deletions tests/test_cargo_lock_expand.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def test_main(helpers: conftest.Helpers) -> None:
with helpers.testpkgs(init_git=True) as path:
main(
["--file", str(path), "--commit", "cargoLockExpand", "--version", "v0.3.8"]
["--file", str(path), "--commit", "cargoLock.expand", "--version", "v0.3.8"]
)
subprocess.run(
[
Expand All @@ -19,7 +19,7 @@ def test_main(helpers: conftest.Helpers) -> None:
"nix-command",
"-f",
path,
"cargoLockExpand.cargoDeps",
"cargoLock.expand.cargoDeps",
],
check=True,
text=True,
Expand All @@ -32,6 +32,7 @@ def test_main(helpers: conftest.Helpers) -> None:
check=True,
).stdout.strip()
print(diff)
assert "cargoLock.expand: 0.3.7 -> 0.3.8"
assert "Cargo.lock" in diff
assert '+source = "git+' in diff
assert "outputHashes" in diff
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cargo_lock_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_main(helpers: conftest.Helpers) -> None:
"--file",
str(path),
"--commit",
"cargoLockUpdate",
"cargoLock.update",
"--version",
"v0.0.255",
]
Expand All @@ -26,7 +26,7 @@ def test_main(helpers: conftest.Helpers) -> None:
"nix-command",
"-f",
path,
"cargoLockUpdate.cargoDeps",
"cargoLock.update.cargoDeps",
],
check=True,
text=True,
Expand Down
4 changes: 2 additions & 2 deletions tests/testpkgs/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> { } }:
{
cargoLockExpand = pkgs.callPackage ./cargo-lock-expand { };
cargoLockUpdate = pkgs.callPackage ./cargo-lock-update { };
cargoLock.expand = pkgs.callPackage ./cargo-lock-expand { };
cargoLock.update = pkgs.callPackage ./cargo-lock-update { };
crate = pkgs.callPackage ./crate.nix { };
gitea = pkgs.callPackage ./gitea.nix { };
github = pkgs.callPackage ./github.nix { };
Expand Down

0 comments on commit f56f553

Please sign in to comment.