Permalink
Browse files

Update Makefile to work with new test file formats.

Update the statements tests to work with joins.
  • Loading branch information...
1 parent 53a625d commit 307bebcc6a455f82fee78bd43be7cfaa08624ea6 @drtyhbo committed Jan 12, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 Makefile
  2. +3 −3 lib/db/backends/mysql/test.statements.js
View
@@ -2,4 +2,4 @@ noop:
echo "Usage: make tests"
test:
- find lib -name "*.test.js" -exec nodeunit {} \;
+ find lib -name "test.*.js" -exec nodeunit {} \;
@@ -73,11 +73,11 @@ module.exports = testCase({
fm = new ForeignModel({id: 128});
qs = MyModel.objects.filter({IntegerField: 20, CharField: 'abc', ForeignKeyField: fm});
test.equal(new statements.Select(qs).getSQL(),
- 'SELECT mymodel.integer_field AS mymodel__integer_field, mymodel.char_field AS mymodel__char_field, mymodel.text_field AS mymodel__text_field, mymodel.boolean_field AS mymodel__boolean_field, mymodel.date_time_field AS mymodel__date_time_field, mymodel.foreign_key_field_id AS mymodel__foreign_key_field_id, mymodel.id AS mymodel__id, foreign.id AS foreign__id from mymodel, foreign WHERE mymodel.foreign_key_field_id=foreign.id AND mymodel.integer_field=20 AND mymodel.char_field="abc" AND mymodel.foreign_key_field_id=128');
+ 'SELECT mymodel.integer_field AS mymodel__integer_field, mymodel.char_field AS mymodel__char_field, mymodel.text_field AS mymodel__text_field, mymodel.boolean_field AS mymodel__boolean_field, mymodel.date_time_field AS mymodel__date_time_field, mymodel.foreign_key_field_id AS mymodel__foreign_key_field_id, mymodel.id AS mymodel__id, foreign.id AS foreign__id FROM mymodel LEFT JOIN (`foreign`) ON (mymodel.foreign_key_field_id=foreign.id) WHERE mymodel.integer_field=20 AND mymodel.char_field="abc" AND mymodel.foreign_key_field_id=128');
qs = MyModel.objects.filter({IntegerField: 20, CharField: 'abc', BooleanField: true, DateTimeField: new Date(1294778991323)});
- test.equal(new statements.Select(qs).getSQL(),
- 'SELECT mymodel.integer_field AS mymodel__integer_field, mymodel.char_field AS mymodel__char_field, mymodel.text_field AS mymodel__text_field, mymodel.boolean_field AS mymodel__boolean_field, mymodel.date_time_field AS mymodel__date_time_field, mymodel.foreign_key_field_id AS mymodel__foreign_key_field_id, mymodel.id AS mymodel__id, foreign.id AS foreign__id from mymodel, foreign WHERE mymodel.foreign_key_field_id=foreign.id AND mymodel.integer_field=20 AND mymodel.char_field="abc" AND mymodel.boolean_field=1 AND mymodel.date_time_field="2011-01-11 20:49:51"');
+ test.strictEqual(new statements.Select(qs).getSQL(),
+ 'SELECT mymodel.integer_field AS mymodel__integer_field, mymodel.char_field AS mymodel__char_field, mymodel.text_field AS mymodel__text_field, mymodel.boolean_field AS mymodel__boolean_field, mymodel.date_time_field AS mymodel__date_time_field, mymodel.foreign_key_field_id AS mymodel__foreign_key_field_id, mymodel.id AS mymodel__id, foreign.id AS foreign__id FROM mymodel LEFT JOIN (`foreign`) ON (mymodel.foreign_key_field_id=foreign.id) WHERE mymodel.integer_field=20 AND mymodel.char_field="abc" AND mymodel.boolean_field=1 AND mymodel.date_time_field="2011-01-11 20:49:51"');
test.done();
},

0 comments on commit 307bebc

Please sign in to comment.