edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! Test support for GPUI. |
| 2 | //! |
| 3 | //! GPUI provides first-class support for testing, which includes a macro to run test that rely on having a context, |
| 4 | //! and a test implementation of the `ForegroundExecutor` and `BackgroundExecutor` which ensure that your tests run |
| 5 | //! deterministically even in the face of arbitrary parallelism. |
| 6 | //! |
| 7 | //! The output of the `gpui::test` macro is understood by other rust test runners, so you can use it with `cargo test` |
| 8 | //! or `cargo-nextest`, or another runner of your choice. |
| 9 | //! |
| 10 | //! To make it possible to test collaborative user interfaces (like Zed) you can ask for as many different contexts |
| 11 | //! as you need. |
| 12 | //! |
| 13 | //! ## Example |
| 14 | //! |
| 15 | //! ``` |
| 16 | //! use gpui; |
| 17 | //! |
| 18 | //! #[gpui::test] |
| 19 | //! async fn test_example(cx: &TestAppContext) { |
| 20 | //! assert!(true) |
| 21 | //! } |
| 22 | //! |
| 23 | //! #[gpui::test] |
| 24 | //! async fn test_collaboration_example(cx_a: &TestAppContext, cx_b: &TestAppContext) { |
| 25 | //! assert!(true) |
| 26 | //! } |
| 27 | //! ``` |
| 28 | use crate::; |
| 29 | use StreamExt as _; |
| 30 | use *; |
| 31 | use channel; |
| 32 | use |
| 33 | |
| 34 | |
| 35 | |
| 36 | ; |
| 37 | |
| 38 | /// Run the given test function with the configured parameters. |
| 39 | /// This is intended for use with the `gpui::test` macro |
| 40 | /// and generally should not be used directly. |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | , |
| 46 | on_fail_fn: , |
| 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 | |
| 83 | |
| 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 | |
| 131 | |
| 132 | |
| 133 | /// A test struct for converting an observation callback into a stream. |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | /// observe returns a stream of the change events from the given `Entity` |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 |