Skip to content

Commit b79f946

Browse files
committed
Add tests
1 parent 209e0b3 commit b79f946

File tree

1 file changed

+61
-0
lines changed
  • scopegraphs/src/containers

1 file changed

+61
-0
lines changed

scopegraphs/src/containers/env.rs

+61
Original file line numberDiff line numberDiff line change
@@ -287,3 +287,64 @@ where
287287
})
288288
}
289289
}
290+
291+
292+
#[cfg(test)]
293+
mod test {
294+
use scopegraphs_macros::{label_order, Label};
295+
296+
use crate::{completeness::{Delay, ExplicitClose}, containers::ResolveOrUserError, resolve::{DataEquivalence, DataWellformedness, Resolve}, ScopeGraph, Storage};
297+
298+
pub mod scopegraphs {
299+
pub use crate::*;
300+
}
301+
302+
303+
macro_rules! t {
304+
($DWFO: ty, $DEQO: ty, $OUT: ty) => {
305+
{
306+
#[derive(Label, Clone, Copy, Debug, PartialEq, Eq, Hash)]
307+
enum Lbl { }
308+
309+
fn test_dwf<'a>(_ : impl DataWellformedness<'a, u32, Output = $DWFO>) { }
310+
fn test_equiv<'a>(_ : impl DataEquivalence<'a, u32, Output = $DEQO>) { }
311+
312+
fn some_dwf(_: &u32) -> $DWFO {
313+
todo!()
314+
}
315+
316+
fn some_equiv(_: &u32, _: &u32) -> $DEQO {
317+
todo!()
318+
}
319+
320+
321+
let storage = Storage::new();
322+
let sg: ScopeGraph<Lbl, u32, _> = ScopeGraph::new(&storage, ExplicitClose::default());
323+
324+
let dwf = some_dwf;
325+
let equiv = some_equiv;
326+
327+
test_dwf(dwf);
328+
test_equiv(equiv);
329+
330+
let query: $OUT = sg.query()
331+
.with_path_wellformedness(query_regex!(Lbl: e))
332+
.with_data_wellformedness(dwf)
333+
.with_data_equivalence(equiv)
334+
// .with_label_order(label_order!(Lbl))
335+
.resolve(todo!());
336+
}
337+
};
338+
}
339+
340+
#[test]
341+
fn test_type() {
342+
if false {
343+
t![bool, bool, Result<_, Delay<_>>];
344+
t![Result<bool, ()>, bool, Result<_, ResolveOrUserError<Delay<_>, ()>>];
345+
t![bool, Result<bool, ()>, Result<_, ResolveOrUserError<Delay<_>, ()>>];
346+
t![Result<bool, ()>, Result<bool, ()>, Result<_, ResolveOrUserError<Delay<_>, ()>>];
347+
}
348+
}
349+
350+
}

0 commit comments

Comments
 (0)