edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBdadd2f4Tahinli3 months ago372 commits
| 1 | //! Throwaway paths for the tests, and the one rule about them: everything a |
| 2 | //! test writes goes inside a directory that deletes itself. |
| 3 | //! |
| 4 | //! [`Scratch`] is that directory. It derefs to a path -- the directory itself, |
| 5 | //! or the one file inside it -- so a helper that used to hand back a `PathBuf` |
| 6 | //! hands back one of these instead and its call sites do not change. `Drop` is |
| 7 | //! what cleans up, which is the whole point: unwinding runs it, so a *failing* |
| 8 | //! test leaves nothing behind either. The suites used to litter `/tmp` with a |
| 9 | //! fresh `ve_*` directory per run and never take one back; on this machine that |
| 10 | //! reached 2907 of them. |
| 11 | //! |
| 12 | //! Nothing outside a test has any use for this. It lives in the library rather |
| 13 | //! than in a test file because the integration suites, the unit tests here and |
| 14 | //! the app's own tests all need the same guard, and none of them can see each |
| 15 | //! other's modules. |
| 16 | |
| 17 | use OsStr; |
| 18 | use Deref; |
| 19 | use ; |
| 20 | use ; |
| 21 | |
| 22 | /// A temporary directory and the path a test uses inside it, gone when the |
| 23 | /// value is. |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | /// A fresh, empty directory under the system temporary one. `name` leads it so |
| 31 | /// it is recognisable while a test is stopped in it; the process id and a |
| 32 | /// counter follow, because two suites (or two tests of one suite, in parallel) |
| 33 | /// must not write each other's files. Canonical, because saved projects hold |
| 34 | /// paths relative to their own directory and `Project` canonicalises what it is |
| 35 | /// handed. |
| 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 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | /// So one of these can be handed to a `Command` as an argument, which is how |
| 83 | /// the suites that check our output with ffmpeg name the file. |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 |