Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSchema Inference Tests #905
Comments
killercup
added
the
tests
label
May 14, 2017
sgrif
added
the
enhancement
label
May 14, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
killercup commentedMay 14, 2017
There are several places where the schema inference is tested, e.g., in the integration tests of
diesel_tests, or the CLI tests fordiesel print-schema. I think it'd make sense to also add some tests that focus only on creating a table and asserting the correcttable!call gets written.To implement this, you'd probably start by splitting off parts of the
expand_infer_table_from_schemafunction into a new fn that accepts a given connection. Then, write tests that create a table, call the new fn to get the tokens of atable!call, and compare this to an expected output. (Afterwards, make sure the new table has been dropped; this happens automatically when usingbegin_test_transactionwith SQLite and PG but doesn't work with MySQL.)Interesting edge cases: Unusual type combinations (e.g., arrays of network addresses), multiple primary keys (expect error on >4 with current code), huge amounts of columns.