From 385cda1cb2795015852a87a48c5a33cc9d4da94e Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Tue, 29 May 2018 07:44:30 -0700 Subject: [PATCH] Add a test. --- query-algebrizer/tests/ground.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/query-algebrizer/tests/ground.rs b/query-algebrizer/tests/ground.rs index 150b031e..a07ed081 100644 --- a/query-algebrizer/tests/ground.rs +++ b/query-algebrizer/tests/ground.rs @@ -225,6 +225,19 @@ fn test_ground_tuple_infers_types() { assert_eq!(cc.bound_value(&Variable::from_valid_name("?v")), Some(TypedValue::Long(10))); } +// We determine the types of variables in the query in an early first pass, and thus we can +// safely use idents to name entities, including attributes. +#[test] +fn test_ground_coll_infers_attribute_types() { + let q = r#"[:find ?x + :where [(ground [:foo/age :foo/height]) [?a ...]] + [?x ?a ?v]]"#; + let schema = prepopulated_schema(); + let known = Known::for_schema(&schema); + let cc = alg(known, &q); + assert!(cc.empty_because.is_none()); +} + #[test] fn test_ground_rel_infers_types() { let q = r#"[:find ?x :where [?x :foo/age ?v] [(ground [[8 10]]) [[?x ?v]]]]"#;