[Groonga-commit] groonga/gcs [master] Add tests for auto detection about index field types from the database

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 1日 (水) 14:44:34 JST


piro	2012-08-01 14:44:34 +0900 (Wed, 01 Aug 2012)

  New Revision: 5029cde30cfc83a65dec654ed9ffb2c77a4fe9a9
  https://github.com/groonga/gcs/commit/5029cde30cfc83a65dec654ed9ffb2c77a4fe9a9

  Log:
    Add tests for auto detection about index field types from the database

  Modified files:
    test/database-index-field.test.js

  Modified: test/database-index-field.test.js (+33 -0)
===================================================================
--- test/database-index-field.test.js    2012-08-01 14:39:00 +0900 (2759132)
+++ test/database-index-field.test.js    2012-08-01 14:44:34 +0900 (06c77a2)
@@ -136,5 +136,38 @@ suite('domain', function() {
       });
     });
 
+    suite('getting data from database', function() {
+      var temporaryDatabase;
+      var context;
+      var domain;
+
+      setup(function() {
+        temporaryDatabase = utils.createTemporaryDatabase();
+        context = temporaryDatabase.get();
+        utils.loadDumpFile(context, __dirname + '/fixture/companies/ddl.grn');
+        domain = new Domain('companies', context);
+      });
+
+      teardown(function() {
+        domain = undefined;
+        temporaryDatabase.teardown();
+        temporaryDatabase = undefined;
+      });
+
+      test('type detection (text)', function() {
+        var field = new IndexField('name', domain);
+        assert.equal(field.type, 'text');
+      });
+
+      test('type detection (uint)', function() {
+        var field = new IndexField('age', domain);
+        assert.equal(field.type, 'uint');
+      });
+
+      test('type detection (literal)', function() {
+        var field = new IndexField('product', domain);
+        assert.equal(field.type, 'literal');
+      });
+    });
   });
 });
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
다운로드 



Groonga-commit メーリングリストの案内
Back to archive index