0 | |
From f52f8335a3a33975ca8a1bc3664331791f81ef52 Mon Sep 17 00:00:00 2001
|
1 | |
From: Wolfgang Silbermayr <wolfgang@silbermayr.at>
|
2 | |
Date: Thu, 13 Dec 2018 05:31:58 +0100
|
3 | |
Subject: [PATCH] Use tempfile instead of tempdir
|
4 | |
|
5 | |
---
|
6 | |
Cargo.toml | 4 ++--
|
7 | |
tests/tests.rs | 28 ++++++++++++++--------------
|
8 | |
2 files changed, 16 insertions(+), 16 deletions(-)
|
9 | |
|
10 | |
diff --git a/Cargo.toml b/Cargo.toml
|
11 | |
index ac8186d..605d356 100644
|
12 | |
--- a/Cargo.toml
|
13 | |
+++ b/Cargo.toml
|
14 | |
@@ -28,5 +28,5 @@ crate-type = ["dylib", "rlib"]
|
15 | |
|
16 | |
[[bin]]
|
17 | |
name = "rustdoc-stripper"
|
18 | |
-[dev-dependencies.tempdir]
|
19 | |
-version = "0.3.4"
|
20 | |
+[dev-dependencies.tempfile]
|
21 | |
+version = "3"
|
22 | |
diff --git a/tests/tests.rs b/tests/tests.rs
|
23 | |
index 5d09ee9..08c3f6a 100644
|
24 | |
--- a/tests/tests.rs
|
25 | |
+++ b/tests/tests.rs
|
26 | |
@@ -13,12 +13,12 @@
|
27 | |
// limitations under the License.
|
28 | |
|
29 | |
extern crate stripper_lib;
|
30 | |
-extern crate tempdir;
|
31 | |
+extern crate tempfile;
|
32 | |
|
33 | |
use std::fs::File;
|
34 | |
use std::io::prelude::*;
|
35 | |
use std::path::Path;
|
36 | |
-use tempdir::TempDir;
|
37 | |
+use tempfile::{TempDir, tempdir};
|
38 | |
|
39 | |
const BASIC : &'static str = r#"//! File comment
|
40 | |
//! three
|
41 | |
@@ -445,7 +445,7 @@ fn compare_files(expected_content: &str, file: &Path) {
|
42 | |
fn test_strip() {
|
43 | |
let test_file = "basic.rs";
|
44 | |
let comment_file = "basic.md";
|
45 | |
- let temp_dir = TempDir::new("").unwrap();
|
46 | |
+ let temp_dir = tempdir().unwrap();
|
47 | |
gen_file(&temp_dir, test_file, BASIC);
|
48 | |
{
|
49 | |
let mut f = gen_file(&temp_dir, comment_file, "");
|
50 | |
@@ -460,7 +460,7 @@ fn test_strip() {
|
51 | |
fn test_regeneration() {
|
52 | |
let test_file = "basic.rs";
|
53 | |
let comment_file = "basic.md";
|
54 | |
- let temp_dir = TempDir::new("").unwrap();
|
55 | |
+ let temp_dir = tempdir().unwrap();
|
56 | |
gen_file(&temp_dir, test_file, BASIC_STRIPPED);
|
57 | |
gen_file(&temp_dir, comment_file, &get_basic_md(test_file));
|
58 | |
stripper_lib::regenerate_doc_comments(temp_dir.path().to_str().unwrap(), false,
|
59 | |
@@ -474,7 +474,7 @@ fn test_regeneration() {
|
60 | |
fn test2_strip() {
|
61 | |
let test_file = "basic.rs";
|
62 | |
let comment_file = "basic.md";
|
63 | |
- let temp_dir = TempDir::new("").unwrap();
|
64 | |
+ let temp_dir = tempdir().unwrap();
|
65 | |
gen_file(&temp_dir, test_file, BASIC2);
|
66 | |
{
|
67 | |
let mut f = gen_file(&temp_dir, comment_file, "");
|
68 | |
@@ -489,7 +489,7 @@ fn test2_strip() {
|
69 | |
fn test2_regeneration() {
|
70 | |
let test_file = "basic.rs";
|
71 | |
let comment_file = "basic.md";
|
72 | |
- let temp_dir = TempDir::new("").unwrap();
|
73 | |
+ let temp_dir = tempdir().unwrap();
|
74 | |
gen_file(&temp_dir, test_file, BASIC2_STRIPPED);
|
75 | |
gen_file(&temp_dir, comment_file, BASIC2_MD);
|
76 | |
stripper_lib::regenerate_doc_comments(temp_dir.path().to_str().unwrap(), false,
|
77 | |
@@ -503,7 +503,7 @@ fn test2_regeneration() {
|
78 | |
fn test3_strip() {
|
79 | |
let test_file = "basic.rs";
|
80 | |
let comment_file = "basic.md";
|
81 | |
- let temp_dir = TempDir::new("").unwrap();
|
82 | |
+ let temp_dir = tempdir().unwrap();
|
83 | |
gen_file(&temp_dir, test_file, BASIC3);
|
84 | |
{
|
85 | |
let mut f = gen_file(&temp_dir, comment_file, "");
|
86 | |
@@ -518,7 +518,7 @@ fn test3_strip() {
|
87 | |
fn test3_regeneration() {
|
88 | |
let test_file = "basic.rs";
|
89 | |
let comment_file = "basic.md";
|
90 | |
- let temp_dir = TempDir::new("").unwrap();
|
91 | |
+ let temp_dir = tempdir().unwrap();
|
92 | |
gen_file(&temp_dir, test_file, BASIC3_STRIPPED);
|
93 | |
gen_file(&temp_dir, comment_file, &get_basic3_md(test_file));
|
94 | |
stripper_lib::regenerate_doc_comments(temp_dir.path().to_str().unwrap(), false,
|
95 | |
@@ -532,7 +532,7 @@ fn test3_regeneration() {
|
96 | |
fn test4_strip() {
|
97 | |
let test_file = "basic.rs";
|
98 | |
let comment_file = "basic.md";
|
99 | |
- let temp_dir = TempDir::new("").unwrap();
|
100 | |
+ let temp_dir = tempdir().unwrap();
|
101 | |
gen_file(&temp_dir, test_file, BASIC4);
|
102 | |
{
|
103 | |
let mut f = gen_file(&temp_dir, comment_file, "");
|
104 | |
@@ -547,7 +547,7 @@ fn test4_strip() {
|
105 | |
fn test4_regeneration() {
|
106 | |
let test_file = "basic.rs";
|
107 | |
let comment_file = "basic.md";
|
108 | |
- let temp_dir = TempDir::new("").unwrap();
|
109 | |
+ let temp_dir = tempdir().unwrap();
|
110 | |
gen_file(&temp_dir, test_file, BASIC4);
|
111 | |
gen_file(&temp_dir, comment_file, &get_basic4_md());
|
112 | |
stripper_lib::regenerate_doc_comments(temp_dir.path().to_str().unwrap(), false,
|
113 | |
@@ -561,7 +561,7 @@ fn test4_regeneration() {
|
114 | |
fn test5_strip() {
|
115 | |
let test_file = "basic.rs";
|
116 | |
let comment_file = "basic.md";
|
117 | |
- let temp_dir = TempDir::new("").unwrap();
|
118 | |
+ let temp_dir = tempdir().unwrap();
|
119 | |
gen_file(&temp_dir, test_file, BASIC5);
|
120 | |
{
|
121 | |
let mut f = gen_file(&temp_dir, comment_file, "");
|
122 | |
@@ -576,7 +576,7 @@ fn test5_strip() {
|
123 | |
fn test5_regeneration() {
|
124 | |
let test_file = "basic.rs";
|
125 | |
let comment_file = "basic.md";
|
126 | |
- let temp_dir = TempDir::new("").unwrap();
|
127 | |
+ let temp_dir = tempdir().unwrap();
|
128 | |
gen_file(&temp_dir, test_file, BASIC5_STRIPPED);
|
129 | |
gen_file(&temp_dir, comment_file, &get_basic5_md(test_file));
|
130 | |
stripper_lib::regenerate_doc_comments(temp_dir.path().to_str().unwrap(), false,
|
131 | |
@@ -591,7 +591,7 @@ fn test5_regeneration() {
|
132 | |
fn test6_regeneration() {
|
133 | |
let test_file = "basic.rs";
|
134 | |
let comment_file = "basic.md";
|
135 | |
- let temp_dir = TempDir::new("").unwrap();
|
136 | |
+ let temp_dir = tempdir().unwrap();
|
137 | |
gen_file(&temp_dir, test_file, BASIC6);
|
138 | |
gen_file(&temp_dir, comment_file, &get_basic6_md(test_file));
|
139 | |
stripper_lib::regenerate_doc_comments(temp_dir.path().to_str().unwrap(), false,
|
140 | |
@@ -606,7 +606,7 @@ fn test6_regeneration() {
|
141 | |
fn test7_regeneration() {
|
142 | |
let test_file = "basic.rs";
|
143 | |
let comment_file = "basic.md";
|
144 | |
- let temp_dir = TempDir::new("").unwrap();
|
145 | |
+ let temp_dir = tempdir().unwrap();
|
146 | |
gen_file(&temp_dir, test_file, BASIC7);
|
147 | |
gen_file(&temp_dir, comment_file, &get_basic7_md(test_file));
|
148 | |
stripper_lib::regenerate_doc_comments(temp_dir.path().to_str().unwrap(), false,
|
149 | |
--
|
150 | |
2.20.0
|
151 | |
|