File: test-from-filename-iter.rs

package info (click to toggle)
rust-dotenv 0.15.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 196 kB
  • sloc: makefile: 15
file content (23 lines) | stat: -rw-r--r-- 465 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mod common;

use std::env;
use dotenv::*;

use crate::common::*;

#[test]
#[allow(deprecated)]
fn test_from_filename_iter() {
    let dir = make_test_dotenv().unwrap();

    let iter = from_filename_iter(".env").unwrap();

    assert!(env::var("TESTKEY").is_err());

    iter.load().ok();

    assert_eq!(env::var("TESTKEY").unwrap(), "test_val");

    env::set_current_dir(dir.path().parent().unwrap()).unwrap();
    dir.close().unwrap();
}