File: fix_tests_without_cache_feature.patch

package info (click to toggle)
rust-pdf 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 616 kB
  • sloc: makefile: 2
file content (66 lines) | stat: -rw-r--r-- 1,967 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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Description: Ignore these functions when cache feature is not enabled
 This permits the tests that don't have the cache feature to not fail on these
Forwarded: https://github.com/pdf-rs/pdf/pull/209
Last-Update: 2024-01-18

--- a/examples/content.rs
+++ b/examples/content.rs
@@ -14,6 +14,7 @@
 
 use pdf::primitive::PdfString;
 
+#[cfg(feature="cache")]
 fn main() -> Result<(), PdfError> {
     let path = PathBuf::from(env::args_os().nth(1).expect("no file given"));
     
--- a/examples/metadata.rs
+++ b/examples/metadata.rs
@@ -5,6 +5,7 @@
 use pdf::object::{FieldDictionary, FieldType, Resolve};
 
 /// extract and print a PDF's metadata
+#[cfg(feature="cache")]
 fn main() -> Result<(), PdfError> {
     let path = args()
         .nth(1)
--- a/examples/names.rs
+++ b/examples/names.rs
@@ -60,6 +60,7 @@
     }
 }
 
+#[cfg(feature="cache")]
 fn main() {
     let path = args().nth(1).expect("no file given");
     println!("read: {}", path);
--- a/examples/read.rs
+++ b/examples/read.rs
@@ -21,6 +21,7 @@
     }
 }
 
+#[cfg(feature="cache")]
 fn main() -> Result<(), PdfError> {
     let path = args().nth(1).expect("no file given");
     println!("read: {}", path);
--- a/tests/integration.rs
+++ b/tests/integration.rs
@@ -23,7 +23,7 @@
 #[test]
 fn open_file() {
     let _ = run!(FileOptions::uncached().open(file_path!("example.pdf")));
-    #[cfg(feature = "mmap")]
+    #[cfg(all(feature = "mmap", feature = "cache"))]
     let _ = run!({
         use memmap2::Mmap;
         let file = std::fs::File::open(file_path!("example.pdf")).expect("can't open file");
--- a/examples/other_page_content.rs
+++ b/examples/other_page_content.rs
@@ -8,6 +8,7 @@
 /// Extract data from a page entry that is under "other".
 /// This example looks for stikethroughs in the annotations entry
 /// and returns a Vec<Rect> for the bounds of the struckthrough text.
+#[cfg(feature="cache")]
 fn main() -> Result<(), PdfError> {
     let path = args()
         .nth(1)