Skip to content

Commit 2d2b65f

Browse files
chore: Don't ignore generated app code in UI tests
1 parent 971f2e3 commit 2d2b65f

File tree

472 files changed

+22339
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

472 files changed

+22339
-1
lines changed

compiler/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
target
22
metadata.json
3-
**/generated_app/
3+
**/generated_app/blueprint.ron
44
Cargo.lock
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "application_9d63a47c"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[package.metadata.px.generate]
7+
generator_type = "cargo_workspace_binary"
8+
generator_name = "app_9d63a47c"
9+
10+
[dependencies]
11+
app_9d63a47c = { version = "0.1", path = "..", default-features = false }
12+
http = { version = "1", default-features = false }
13+
hyper = { version = "1", default-features = false }
14+
matchit = { version = "0.9", default-features = false }
15+
pavex = { version = "0.2", path = "../../../../../runtime/pavex", default-features = false }
16+
serde = { version = "1", default-features = false }
17+
thiserror = { version = "2", default-features = false }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "application_9d63a47c"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[package.metadata.px.generate]
7+
generator_type = "cargo_workspace_binary"
8+
generator_name = "app_9d63a47c"
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
//! Do NOT edit this code.
2+
//! It was automatically generated by Pavex.
3+
//! All manual edits will be lost next time the code is generated.
4+
extern crate alloc;
5+
struct ServerState {
6+
router: Router,
7+
application_state: ApplicationState,
8+
}
9+
#[derive(Debug, Clone, serde::Deserialize)]
10+
pub struct ApplicationConfig {}
11+
pub struct ApplicationState {
12+
pub a: app_9d63a47c::A,
13+
}
14+
impl ApplicationState {
15+
pub async fn new(
16+
_app_config: crate::ApplicationConfig,
17+
) -> Result<crate::ApplicationState, crate::ApplicationStateError> {
18+
Ok(Self::_new().await)
19+
}
20+
async fn _new() -> crate::ApplicationState {
21+
let v0 = app_9d63a47c::a();
22+
crate::ApplicationState { a: v0 }
23+
}
24+
}
25+
#[derive(Debug, thiserror::Error)]
26+
pub enum ApplicationStateError {}
27+
pub fn run(
28+
server_builder: pavex::server::Server,
29+
application_state: ApplicationState,
30+
) -> pavex::server::ServerHandle {
31+
async fn handler(
32+
request: http::Request<hyper::body::Incoming>,
33+
connection_info: Option<pavex::connection::ConnectionInfo>,
34+
server_state: std::sync::Arc<ServerState>,
35+
) -> pavex::Response {
36+
let (router, state) = (&server_state.router, &server_state.application_state);
37+
router.route(request, connection_info, state).await
38+
}
39+
let router = Router::new();
40+
let server_state = std::sync::Arc::new(ServerState {
41+
router,
42+
application_state,
43+
});
44+
server_builder.serve(handler, server_state)
45+
}
46+
struct Router {
47+
router: matchit::Router<u32>,
48+
}
49+
impl Router {
50+
/// Create a new router instance.
51+
///
52+
/// This method is invoked once, when the server starts.
53+
pub fn new() -> Self {
54+
Self { router: Self::router() }
55+
}
56+
fn router() -> matchit::Router<u32> {
57+
let mut router = matchit::Router::new();
58+
router.insert("/handler", 0u32).unwrap();
59+
router
60+
}
61+
pub async fn route(
62+
&self,
63+
request: http::Request<hyper::body::Incoming>,
64+
_connection_info: Option<pavex::connection::ConnectionInfo>,
65+
#[allow(unused)]
66+
state: &ApplicationState,
67+
) -> pavex::Response {
68+
let (request_head, _) = request.into_parts();
69+
let request_head: pavex::request::RequestHead = request_head.into();
70+
let Ok(matched_route) = self.router.at(&request_head.target.path()) else {
71+
let allowed_methods: pavex::router::AllowedMethods = pavex::router::MethodAllowList::from_iter(
72+
vec![],
73+
)
74+
.into();
75+
return route_0::entrypoint(&allowed_methods).await;
76+
};
77+
match matched_route.value {
78+
0u32 => {
79+
match &request_head.method {
80+
&pavex::http::Method::GET => {
81+
route_1::entrypoint(state.a.clone()).await
82+
}
83+
_ => {
84+
let allowed_methods: pavex::router::AllowedMethods = pavex::router::MethodAllowList::from_iter([
85+
pavex::http::Method::GET,
86+
])
87+
.into();
88+
route_0::entrypoint(&allowed_methods).await
89+
}
90+
}
91+
}
92+
i => unreachable!("Unknown route id: {}", i),
93+
}
94+
}
95+
}
96+
pub mod route_0 {
97+
pub async fn entrypoint<'a>(
98+
s_0: &'a pavex::router::AllowedMethods,
99+
) -> pavex::Response {
100+
let response = wrapping_0(s_0).await;
101+
response
102+
}
103+
async fn stage_1<'a>(s_0: &'a pavex::router::AllowedMethods) -> pavex::Response {
104+
let response = handler(s_0).await;
105+
response
106+
}
107+
async fn wrapping_0(v0: &pavex::router::AllowedMethods) -> pavex::Response {
108+
let v1 = crate::route_0::Next0 {
109+
s_0: v0,
110+
next: stage_1,
111+
};
112+
let v2 = pavex::middleware::Next::new(v1);
113+
let v3 = pavex::middleware::wrap_noop(v2).await;
114+
<pavex::Response as pavex::IntoResponse>::into_response(v3)
115+
}
116+
async fn handler(v0: &pavex::router::AllowedMethods) -> pavex::Response {
117+
let v1 = pavex::router::default_fallback(v0).await;
118+
<pavex::Response as pavex::IntoResponse>::into_response(v1)
119+
}
120+
struct Next0<'a, T>
121+
where
122+
T: std::future::Future<Output = pavex::Response>,
123+
{
124+
s_0: &'a pavex::router::AllowedMethods,
125+
next: fn(&'a pavex::router::AllowedMethods) -> T,
126+
}
127+
impl<'a, T> std::future::IntoFuture for Next0<'a, T>
128+
where
129+
T: std::future::Future<Output = pavex::Response>,
130+
{
131+
type Output = pavex::Response;
132+
type IntoFuture = T;
133+
fn into_future(self) -> Self::IntoFuture {
134+
(self.next)(self.s_0)
135+
}
136+
}
137+
}
138+
pub mod route_1 {
139+
pub async fn entrypoint(s_0: app_9d63a47c::A) -> pavex::Response {
140+
let response = wrapping_0(s_0).await;
141+
response
142+
}
143+
async fn stage_1(s_0: app_9d63a47c::A) -> pavex::Response {
144+
let response = handler(s_0).await;
145+
response
146+
}
147+
async fn wrapping_0(v0: app_9d63a47c::A) -> pavex::Response {
148+
let v1 = crate::route_1::Next0 {
149+
s_0: v0,
150+
next: stage_1,
151+
};
152+
let v2 = pavex::middleware::Next::new(v1);
153+
let v3 = pavex::middleware::wrap_noop(v2).await;
154+
<pavex::Response as pavex::IntoResponse>::into_response(v3)
155+
}
156+
async fn handler(v0: app_9d63a47c::A) -> pavex::Response {
157+
let v1 = <app_9d63a47c::A as core::clone::Clone>::clone(&v0);
158+
let v2 = app_9d63a47c::b(v1);
159+
let v3 = app_9d63a47c::c(&v2);
160+
let v4 = match v3 {
161+
Ok(ok) => ok,
162+
Err(v4) => {
163+
return {
164+
let v5 = app_9d63a47c::default_error_handler(&v4);
165+
<pavex::Response as pavex::IntoResponse>::into_response(v5)
166+
};
167+
}
168+
};
169+
let v5 = app_9d63a47c::H::with_e();
170+
let v6 = app_9d63a47c::H::with_a();
171+
let v7 = <app_9d63a47c::A as core::clone::Clone>::clone(&v0);
172+
let v8 = app_9d63a47c::G::new(v7);
173+
let v9 = app_9d63a47c::E::new();
174+
let v10 = app_9d63a47c::F::new(&v9);
175+
let v11 = app_9d63a47c::d(&v4, &v0);
176+
let v12 = app_9d63a47c::handler(&v0, &v2, &v11, &v9, &v10, &v8, &v6, &v5);
177+
<pavex::Response as pavex::IntoResponse>::into_response(v12)
178+
}
179+
struct Next0<T>
180+
where
181+
T: std::future::Future<Output = pavex::Response>,
182+
{
183+
s_0: app_9d63a47c::A,
184+
next: fn(app_9d63a47c::A) -> T,
185+
}
186+
impl<T> std::future::IntoFuture for Next0<T>
187+
where
188+
T: std::future::Future<Output = pavex::Response>,
189+
{
190+
type Output = pavex::Response;
191+
type IntoFuture = T;
192+
fn into_future(self) -> Self::IntoFuture {
193+
(self.next)(self.s_0)
194+
}
195+
}
196+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "application_3da24ac8"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[package.metadata.px.generate]
7+
generator_type = "cargo_workspace_binary"
8+
generator_name = "app_3da24ac8"
9+
10+
[dependencies]
11+
workspace_hack = { version = "0.1", path = "../../../workspace_hack" }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "application_3da24ac8"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[package.metadata.px.generate]
7+
generator_type = "cargo_workspace_binary"
8+
generator_name = "app_3da24ac8"

compiler/ui_tests/annotations/non_existing_dependency/generated_app/src/lib.rs

Whitespace-only changes.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "application_8055d222"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[package.metadata.px.generate]
7+
generator_type = "cargo_workspace_binary"
8+
generator_name = "app_8055d222"
9+
10+
[dependencies]
11+
workspace_hack = { version = "0.1", path = "../../../workspace_hack" }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "application_8055d222"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[package.metadata.px.generate]
7+
generator_type = "cargo_workspace_binary"
8+
generator_name = "app_8055d222"

compiler/ui_tests/annotations/non_existing_module/generated_app/src/lib.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)