Change expecteddatoms and expectedtransaction to their kebab-case counterparts, for valid EDN style. Fixes #270. r=nalexander (#287)
This commit is contained in:
parent
4f5c94891a
commit
4e81733eed
3 changed files with 23 additions and 25 deletions
|
@ -865,10 +865,8 @@ mod tests {
|
||||||
let transaction = transaction.as_map().unwrap();
|
let transaction = transaction.as_map().unwrap();
|
||||||
let label: edn::Value = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "label"))).unwrap().clone();
|
let label: edn::Value = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "label"))).unwrap().clone();
|
||||||
let assertions: edn::Value = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "assertions"))).unwrap().clone();
|
let assertions: edn::Value = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "assertions"))).unwrap().clone();
|
||||||
// TODO: use hyphenated keywords, like :test/expected-transaction -- when the EDN parser
|
let expected_transaction: Option<&edn::Value> = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "expected-transaction")));
|
||||||
// supports them!
|
let expected_datoms: Option<&edn::Value> = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "expected-datoms")));
|
||||||
let expected_transaction: Option<&edn::Value> = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "expectedtransaction")));
|
|
||||||
let expected_datoms: Option<&edn::Value> = transaction.get(&edn::Value::NamespacedKeyword(symbols::NamespacedKeyword::new("test", "expecteddatoms")));
|
|
||||||
|
|
||||||
let entities: Vec<_> = mentat_tx_parser::Tx::parse(&[assertions][..]).unwrap();
|
let entities: Vec<_> = mentat_tx_parser::Tx::parse(&[assertions][..]).unwrap();
|
||||||
db.transact_internal(&conn, &entities[..], bootstrap::TX0 + index + 1).unwrap();
|
db.transact_internal(&conn, &entities[..], bootstrap::TX0 + index + 1).unwrap();
|
||||||
|
@ -890,7 +888,7 @@ mod tests {
|
||||||
// Don't allow empty tests. This will need to change if we allow transacting schema
|
// Don't allow empty tests. This will need to change if we allow transacting schema
|
||||||
// fragments in a preamble, but for now it might catch malformed tests.
|
// fragments in a preamble, but for now it might catch malformed tests.
|
||||||
assert_ne!((expected_transaction, expected_datoms), (None, None),
|
assert_ne!((expected_transaction, expected_datoms), (None, None),
|
||||||
"Transaction test must include at least one of :test/expectedtransaction or :test/expecteddatoms");
|
"Transaction test must include at least one of :test/expected-transaction or :test/expected-datoms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/add 100 :db/ident :keyword/value1]
|
[[:db/add 100 :db/ident :keyword/value1]
|
||||||
[:db/add 101 :db/ident :keyword/value2]]
|
[:db/add 101 :db/ident :keyword/value2]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[100 :db/ident :keyword/value1 ?tx1 true]
|
#{[100 :db/ident :keyword/value1 ?tx1 true]
|
||||||
[101 :db/ident :keyword/value2 ?tx1 true]
|
[101 :db/ident :keyword/value2 ?tx1 true]
|
||||||
[?tx1 :db/txInstant ?ms1 ?tx1 true]}
|
[?tx1 :db/txInstant ?ms1 ?tx1 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[100 :db/ident :keyword/value1]
|
#{[100 :db/ident :keyword/value1]
|
||||||
[101 :db/ident :keyword/value2]}}
|
[101 :db/ident :keyword/value2]}}
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/add 200 :db.schema/attribute 100]
|
[[:db/add 200 :db.schema/attribute 100]
|
||||||
[:db/add 200 :db.schema/attribute 101]]
|
[:db/add 200 :db.schema/attribute 101]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[200 :db.schema/attribute 100 ?tx2 true]
|
#{[200 :db.schema/attribute 100 ?tx2 true]
|
||||||
[200 :db.schema/attribute 101 ?tx2 true]
|
[200 :db.schema/attribute 101 ?tx2 true]
|
||||||
[?tx2 :db/txInstant ?ms2 ?tx2 true]}
|
[?tx2 :db/txInstant ?ms2 ?tx2 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[100 :db/ident :keyword/value1]
|
#{[100 :db/ident :keyword/value1]
|
||||||
[101 :db/ident :keyword/value2]
|
[101 :db/ident :keyword/value2]
|
||||||
[200 :db.schema/attribute 100]
|
[200 :db.schema/attribute 100]
|
||||||
|
@ -28,13 +28,13 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/add 100 :db/ident :keyword/value11]
|
[[:db/add 100 :db/ident :keyword/value11]
|
||||||
[:db/add 101 :db/ident :keyword/value22]]
|
[:db/add 101 :db/ident :keyword/value22]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[100 :db/ident :keyword/value1 ?tx3 false]
|
#{[100 :db/ident :keyword/value1 ?tx3 false]
|
||||||
[100 :db/ident :keyword/value11 ?tx3 true]
|
[100 :db/ident :keyword/value11 ?tx3 true]
|
||||||
[101 :db/ident :keyword/value2 ?tx3 false]
|
[101 :db/ident :keyword/value2 ?tx3 false]
|
||||||
[101 :db/ident :keyword/value22 ?tx3 true]
|
[101 :db/ident :keyword/value22 ?tx3 true]
|
||||||
[?tx3 :db/txInstant ?ms3 ?tx3 true]}
|
[?tx3 :db/txInstant ?ms3 ?tx3 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[100 :db/ident :keyword/value11]
|
#{[100 :db/ident :keyword/value11]
|
||||||
[101 :db/ident :keyword/value22]
|
[101 :db/ident :keyword/value22]
|
||||||
[200 :db.schema/attribute 100]
|
[200 :db.schema/attribute 100]
|
||||||
|
@ -44,9 +44,9 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/add 100 :db/ident :keyword/value11]
|
[[:db/add 100 :db/ident :keyword/value11]
|
||||||
[:db/add 101 :db/ident :keyword/value22]]
|
[:db/add 101 :db/ident :keyword/value22]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[?tx4 :db/txInstant ?ms4 ?tx4 true]}
|
#{[?tx4 :db/txInstant ?ms4 ?tx4 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[100 :db/ident :keyword/value11]
|
#{[100 :db/ident :keyword/value11]
|
||||||
[101 :db/ident :keyword/value22]
|
[101 :db/ident :keyword/value22]
|
||||||
[200 :db.schema/attribute 100]
|
[200 :db.schema/attribute 100]
|
||||||
|
@ -56,9 +56,9 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/add 200 :db.schema/attribute 100]
|
[[:db/add 200 :db.schema/attribute 100]
|
||||||
[:db/add 200 :db.schema/attribute 101]]
|
[:db/add 200 :db.schema/attribute 101]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[?tx5 :db/txInstant ?ms5 ?tx5 true]}
|
#{[?tx5 :db/txInstant ?ms5 ?tx5 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[100 :db/ident :keyword/value11]
|
#{[100 :db/ident :keyword/value11]
|
||||||
[101 :db/ident :keyword/value22]
|
[101 :db/ident :keyword/value22]
|
||||||
[200 :db.schema/attribute 100]
|
[200 :db.schema/attribute 100]
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/add 100 :db/ident :keyword/value1]
|
[[:db/add 100 :db/ident :keyword/value1]
|
||||||
[:db/add 101 :db/ident :keyword/value2]]
|
[:db/add 101 :db/ident :keyword/value2]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[100 :db/ident :keyword/value1 ?tx1 true]
|
#{[100 :db/ident :keyword/value1 ?tx1 true]
|
||||||
[101 :db/ident :keyword/value2 ?tx1 true]
|
[101 :db/ident :keyword/value2 ?tx1 true]
|
||||||
[?tx1 :db/txInstant ?ms1 ?tx1 true]}
|
[?tx1 :db/txInstant ?ms1 ?tx1 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[100 :db/ident :keyword/value1]
|
#{[100 :db/ident :keyword/value1]
|
||||||
[101 :db/ident :keyword/value2]}}
|
[101 :db/ident :keyword/value2]}}
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/add 200 :db.schema/attribute 100]
|
[[:db/add 200 :db.schema/attribute 100]
|
||||||
[:db/add 200 :db.schema/attribute 101]]
|
[:db/add 200 :db.schema/attribute 101]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[200 :db.schema/attribute 100 ?tx2 true]
|
#{[200 :db.schema/attribute 100 ?tx2 true]
|
||||||
[200 :db.schema/attribute 101 ?tx2 true]
|
[200 :db.schema/attribute 101 ?tx2 true]
|
||||||
[?tx2 :db/txInstant ?ms2 ?tx2 true]}
|
[?tx2 :db/txInstant ?ms2 ?tx2 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[100 :db/ident :keyword/value1]
|
#{[100 :db/ident :keyword/value1]
|
||||||
[101 :db/ident :keyword/value2]
|
[101 :db/ident :keyword/value2]
|
||||||
[200 :db.schema/attribute 100]
|
[200 :db.schema/attribute 100]
|
||||||
|
@ -27,10 +27,10 @@
|
||||||
{:test/label ":db.cardinality/one, retract"
|
{:test/label ":db.cardinality/one, retract"
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/retract 100 :db/ident :keyword/value1]]
|
[[:db/retract 100 :db/ident :keyword/value1]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[100 :db/ident :keyword/value1 ?tx3 false]
|
#{[100 :db/ident :keyword/value1 ?tx3 false]
|
||||||
[?tx3 :db/txInstant ?ms3 ?tx3 true]}
|
[?tx3 :db/txInstant ?ms3 ?tx3 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[101 :db/ident :keyword/value2]
|
#{[101 :db/ident :keyword/value2]
|
||||||
[200 :db.schema/attribute 100]
|
[200 :db.schema/attribute 100]
|
||||||
[200 :db.schema/attribute 101]}}
|
[200 :db.schema/attribute 101]}}
|
||||||
|
@ -38,10 +38,10 @@
|
||||||
{:test/label ":db.cardinality/many, retract"
|
{:test/label ":db.cardinality/many, retract"
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/retract 200 :db.schema/attribute 100]]
|
[[:db/retract 200 :db.schema/attribute 100]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[200 :db.schema/attribute 100 ?tx4 false]
|
#{[200 :db.schema/attribute 100 ?tx4 false]
|
||||||
[?tx4 :db/txInstant ?ms4 ?tx4 true]}
|
[?tx4 :db/txInstant ?ms4 ?tx4 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[101 :db/ident :keyword/value2]
|
#{[101 :db/ident :keyword/value2]
|
||||||
[200 :db.schema/attribute 101]}
|
[200 :db.schema/attribute 101]}
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,9 @@
|
||||||
:test/assertions
|
:test/assertions
|
||||||
[[:db/retract 100 :db/ident :keyword/value1]
|
[[:db/retract 100 :db/ident :keyword/value1]
|
||||||
[:db/retract 200 :db.schema/attribute 100]]
|
[:db/retract 200 :db.schema/attribute 100]]
|
||||||
:test/expectedtransaction
|
:test/expected-transaction
|
||||||
#{[?tx5 :db/txInstant ?ms5 ?tx5 true]}
|
#{[?tx5 :db/txInstant ?ms5 ?tx5 true]}
|
||||||
:test/expecteddatoms
|
:test/expected-datoms
|
||||||
#{[101 :db/ident :keyword/value2]
|
#{[101 :db/ident :keyword/value2]
|
||||||
[200 :db.schema/attribute 101]}
|
[200 :db.schema/attribute 101]}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue