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

Move test harness to separate package #110

Open
wants to merge 65 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8270cb7
Refactor test harness structure
sonro Jul 12, 2024
23c6f9e
Test the test harness
sonro Jul 12, 2024
726c057
Rustfmt test harness
sonro Jul 12, 2024
588959d
Refactor dotenv usage into wrapper
sonro Jul 12, 2024
4833142
Fix envfile contents now represented as bytes
sonro Jul 12, 2024
48d4609
Add more test harness assertions
sonro Jul 12, 2024
461b9eb
Add API wrapper to test harness
sonro Jul 12, 2024
240d0f5
Test empty envfile in harness
sonro Jul 12, 2024
97e69b5
Add EnvFileBuilder to test harness
sonro Jul 12, 2024
88386ac
Test harness BOM handling
sonro Jul 12, 2024
d872f14
Move test harness tests to subdir
sonro Jul 14, 2024
e870d60
Clean harness utility layout
sonro Jul 14, 2024
799cfb6
Move test harness to separate crate
sonro Jul 14, 2024
cddf9bd
Fix const naming convension
sonro Jul 14, 2024
1a93d86
Refactor wrappers into module
sonro Jul 15, 2024
538e196
Flesh out test_util docs
sonro Jul 15, 2024
31cf074
Add more than one envfile to TestEnv
sonro Jul 15, 2024
443ab30
Fix parameter ownership in methods
sonro Jul 15, 2024
972162c
Fix testenv lifetime
sonro Jul 15, 2024
a1a554d
Reflect test harness changes in API docs
sonro Jul 15, 2024
3dfc394
Test adding envfiles to testenv
sonro Jul 15, 2024
c70aa93
Clean TestEnv::add_envfile
sonro Jul 16, 2024
9ba20dd
Test adding env vars to testenv
sonro Jul 16, 2024
0fce979
Simplify adding env vars to testenv
sonro Jul 16, 2024
6992416
Test rest of TestEnv
sonro Jul 16, 2024
55ed501
Test envfile functions
sonro Jul 17, 2024
3471211
Document test util with a readme
sonro Jul 17, 2024
6edeb9f
Fix macos working directory
sonro Jul 17, 2024
896c32f
Remove wrap module
sonro Jul 17, 2024
dc14ec5
Add extra assertions
sonro Jul 17, 2024
1bd15d0
Fix naming consistency
sonro Jul 17, 2024
9974e0b
Add EnvFileBuilder conversions
sonro Jul 17, 2024
2d13009
Fix canonicalize paths
sonro Jul 17, 2024
9219e80
Fix method signature consistancy
sonro Jul 23, 2024
59b4684
Add default existing var testenv
sonro Jul 23, 2024
d4e7d63
clippy::uninlined_format_args
allan2 Jul 30, 2024
dc60d95
clippy::manual_assert
allan2 Jul 30, 2024
9107127
clippy::use_self
allan2 Jul 30, 2024
4183f0c
clippy::cloned_instead_of_copied
allan2 Jul 30, 2024
e2642df
clippy::default_trait_access
allan2 Jul 30, 2024
d39b060
clippy::doc_markdown
allan2 Jul 30, 2024
91f4fa6
clippy::semicolon_if_nothing_returned
allan2 Jul 30, 2024
cf8f41a
test_util clippy::missing_const_for_fn
allan2 Jul 30, 2024
da380d3
test_util clippy::item_after_statements
allan2 Jul 30, 2024
2022513
test_util clippy::inline_always
allan2 Jul 30, 2024
3fa8a68
Add strict clippy lints to test_util crate
allan2 Jul 30, 2024
81b2d5f
rustfmt, allow clippy::should_panic_without_expect
allan2 Jul 30, 2024
b764212
Fix unnecessary assert messages
sonro Jul 30, 2024
cf4cc43
Update authors
sonro Jul 30, 2024
deef3f2
Move dotenvy as dev-only dependency
sonro Jul 30, 2024
1efcba9
Fix rustdoc dotenvy link
sonro Jul 31, 2024
aa9f907
Rename envfile to env_file
sonro Jul 31, 2024
ce6e00b
Add is_empty impl to EnvFileBuilder
sonro Jul 31, 2024
05c9818
Add more trait impls to EnvFileBuilder
sonro Jul 31, 2024
129d68f
Fix testenv reset
sonro Aug 1, 2024
6fa82bc
Remove default testenv
sonro Aug 1, 2024
4dfeed7
Rename EnvFileBuilder to EnvFileContents
sonro Aug 1, 2024
ebc2f6c
Fix testenv var state test
sonro Aug 1, 2024
cef502f
Remove extra Efc methods
sonro Aug 1, 2024
3a9f931
Rename TestEnv::init to new
sonro Aug 1, 2024
16fd9a8
Rename helper functions
sonro Aug 1, 2024
06c3af8
Add Error type to test utilites
sonro Aug 1, 2024
dbba2e4
Fix Efb to Efc in readme
sonro Aug 1, 2024
9aa6b27
Add unsafety to set_var and remove_var
sonro Aug 1, 2024
afb2ea9
Remove dotenvy from test suite
sonro Aug 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[workspace]
resolver = "2"

members = ["dotenv", "dotenv_codegen"]
members = ["dotenv", "dotenv_codegen", "test_util"]
2 changes: 1 addition & 1 deletion dotenv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ required-features = ["cli"]
clap = { version = "4.3.11", optional = true }

[dev-dependencies]
dotenvy_test_util = { path = "../test_util", version = "0.1.0" }
tempfile = "3.3.0"
once_cell = "1.16.0"

[features]
cli = ["clap"]
23 changes: 23 additions & 0 deletions dotenv/tests/integration/dotenv.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use dotenvy_test_util::*;

const TEST_KEY: &str = "TEST_KEY";
const TEST_VALUE: &str = "test_val";
const EXISTING_KEY: &str = "EXISTING_KEY";
const EXISTING_VALUE: &str = "loaded_from_env";

const TEST_ENV_FILE: &str = r"
TEST_KEY=test_val
EXISTING_KEY=loaded_from_file
";

#[test]
fn dotenv_ok() -> Result<(), Error> {
let mut testenv = TestEnv::new()?;
testenv.add_env_file(".env", TEST_ENV_FILE)?;
testenv.add_env_var(EXISTING_KEY, EXISTING_VALUE)?;
test_in_env(&testenv, || {
dotenvy::dotenv().ok();
assert_env_var(TEST_KEY, TEST_VALUE);
assert_env_var(EXISTING_KEY, EXISTING_VALUE);
})
}
2 changes: 1 addition & 1 deletion dotenv/tests/integration/main.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
mod util;
mod dotenv;
67 changes: 0 additions & 67 deletions dotenv/tests/integration/util/mod.rs

This file was deleted.

Loading
Loading