Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix override key bug #19

Merged
merged 3 commits into from
Sep 15, 2022
Merged

Fix override key bug #19

merged 3 commits into from
Sep 15, 2022

Conversation

kgtkr
Copy link
Contributor

@kgtkr kgtkr commented Sep 15, 2022

Fixed a bug where inserting in the order a_b=x, a=y overwrote keys.
I also added a test.

This is the log of the added test before the fix.

$ cargo test 
   Compiling serde-env v0.0.2 (/Volumes/Develop/github/kgtkr/serde-env)
    Finished test [unoptimized + debuginfo] target(s) in 0.69s
     Running unittests src/lib.rs (target/debug/deps/serde_env-26d62904ea096b0f)

running 11 tests
test de::tests::test_from_env_alias ... ignored
test value::tests::test_get ... ok
test value::tests::test_flatten ... ok
test value::tests::test_push ... FAILED
test de::tests::test_ported_from_envy ... ok
test de::tests::test_from_env_flat_upper ... ok
test de::tests::test_from_env_flat_upper_with_default ... ok
test de::tests::test_from_env_as_map ... ok
test de::tests::test_from_env_flat_with_default ... ok
test de::tests::test_from_env_flat ... ok
test de::tests::test_from_env ... ok

failures:

---- value::tests::test_push stdout ----
thread 'value::tests::test_push' panicked at 'assertion failed: `(left == right)`
  left: `{"a": Hello, Earth!}`,
 right: `{"a": ["Hello, Earth!", {"b": {"c": {"d": Hello, World!, "e": Hello, Mars!}, "f": Hello, Moon!}}]}`', src/value.rs:163:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    value::tests::test_push

test result: FAILED. 9 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.01s

error: test failed, to rerun pass '--lib'

@Xuanwo
Copy link
Owner

Xuanwo commented Sep 15, 2022

Nice!

@Xuanwo
Copy link
Owner

Xuanwo commented Sep 15, 2022

Seems this PR will also fix #2?

@kgtkr
Copy link
Contributor Author

kgtkr commented Sep 15, 2022

I think it will probably be fixed (didn't check the issue)

Signed-off-by: Xuanwo <github@xuanwo.io>
@Xuanwo
Copy link
Owner

Xuanwo commented Sep 15, 2022

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants