Skip to content

Commit

Permalink
tests: Use indoc
Browse files Browse the repository at this point in the history
This makes string literals way more legible. Prep for more tests.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Jul 15, 2024
1 parent e1db50f commit 945b0db
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ xshell = { version = "0.2.6", optional = true }
uuid = { version = "1.8.0", features = ["v4"] }

[dev-dependencies]
indoc = "2.0.5"
similar-asserts = { version = "1.5.0" }

[features]
Expand Down
30 changes: 15 additions & 15 deletions lib/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ fn test_generator_fstab() -> Result<()> {

#[test]
fn test_generator_fstab_idempotent() -> Result<()> {
let anaconda_fstab = "\n\
#\n\
# /etc/fstab\n\
# Created by anaconda on Tue Mar 19 12:24:29 2024\n\
#\n\
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.\n\
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.\n\
#\n\
# After editing this file, run 'systemctl daemon-reload' to update systemd\n\
# units generated from this file.\n\
#\n\
# Updated by bootc-fstab-edit.service\n\
UUID=715be2b7-c458-49f2-acec-b2fdb53d9089 / xfs ro 0 0\n\
UUID=341c4712-54e8-4839-8020-d94073b1dc8b /boot xfs defaults 0 0\n\
";
let anaconda_fstab = indoc::indoc! { "
#
# /etc/fstab
# Created by anaconda on Tue Mar 19 12:24:29 2024
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
# Updated by bootc-fstab-edit.service
UUID=715be2b7-c458-49f2-acec-b2fdb53d9089 / xfs ro 0 0
UUID=341c4712-54e8-4839-8020-d94073b1dc8b /boot xfs defaults 0 0
" };
let tempdir = fixture()?;
let unit_dir = &tempdir.open_dir("run/systemd/system")?;

Expand Down

0 comments on commit 945b0db

Please sign in to comment.