aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe')
-rw-r--r--crates/shirabe/src/json/json_file.rs5
-rw-r--r--crates/shirabe/tests/json/json_file_test.rs1
2 files changed, 5 insertions, 1 deletions
diff --git a/crates/shirabe/src/json/json_file.rs b/crates/shirabe/src/json/json_file.rs
index 0ce55e55..91e0d380 100644
--- a/crates/shirabe/src/json/json_file.rs
+++ b/crates/shirabe/src/json/json_file.rs
@@ -220,6 +220,11 @@ impl JsonFile {
hash: PhpMixed,
options: JsonEncodeOptions,
) -> anyhow::Result<()> {
+ let options = JsonEncodeOptions {
+ indent: self.indent.clone(),
+ ..options
+ };
+
if self.path == "php://memory" {
file_put_contents(
&self.path,
diff --git a/crates/shirabe/tests/json/json_file_test.rs b/crates/shirabe/tests/json/json_file_test.rs
index bc0fe223..14cb1e68 100644
--- a/crates/shirabe/tests/json/json_file_test.rs
+++ b/crates/shirabe/tests/json/json_file_test.rs
@@ -204,7 +204,6 @@ fn test_double_escaped_unicode() {
}
#[test]
-#[ignore = "JsonFile::write never forwards self.indent (set by read()'s detect_indenting) into the encode options, unlike PHP's write() which passes $this->indent to encode()"]
fn test_preserve_indentation_after_read() {
let src = fixture_path("tabs.json");
let dst = fixture_path("tabs2.json");