diff --git a/test/definition/_ddl.sql b/test/definition/_ddl.sql new file mode 100644 index 0000000000000000000000000000000000000000..6b9e78728cc7579836aeab2a19996699285cc680 --- /dev/null +++ b/test/definition/_ddl.sql @@ -0,0 +1,36 @@ +-- DROP TABLE IF EXISTS `zt_action`; +CREATE TABLE IF NOT EXISTS `zt_action` ( + `id` mediumint(8) unsigned NOT NULL auto_increment, + `objectType` varchar(30) NOT NULL default '', + `objectID` mediumint(8) unsigned NOT NULL default '0', + `product` varchar(255) NOT NULL, + `project` mediumint(9) NOT NULL, + `actor` varchar(100) NOT NULL default '', + `action` varchar(30) NOT NULL default '', + `date` datetime NOT NULL, + `comment` text NOT NULL, + `extra` text NOT NULL, + `read` enum('0','1') NOT NULL default '0', + PRIMARY KEY (`id`), + KEY `date` (`date`), + KEY `actor` (`actor`), + KEY `project` (`project`), + KEY `objectID` (`objectID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +-- DROP TABLE IF EXISTS `zt_block`; +CREATE TABLE IF NOT EXISTS `zt_block` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `account` char(30) NOT NULL, + `module` varchar(20) NOT NULL, + `title` varchar(100) NOT NULL, + `source` varchar(20) NOT NULL, + `block` varchar(20) NOT NULL, + `params` text NOT NULL, + `order` tinyint(3) unsigned NOT NULL DEFAULT '0', + `grid` tinyint(3) unsigned NOT NULL DEFAULT '0', + `height` smallint(5) unsigned NOT NULL DEFAULT '0', + `hidden` tinyint(1) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + UNIQUE KEY `accountModuleOrder` (`account`,`module`,`order`), + KEY `account` (`account`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/test/definition/inherit.yaml b/test/definition/inherit.yaml index b8654a48a6b41b035cc29c13f539580531bd1d0b..c53289ebb8346439b53bc1c5d20da08fb9c6f38b 100644 --- a/test/definition/inherit.yaml +++ b/test/definition/inherit.yaml @@ -5,14 +5,14 @@ version: 1.0 fields: - field: basic - note: 继承基本字段 + note: inherit from basic field loop: 2 loopfix: " " prefix: "{" postfix: "}" - field: refer2 - note: 继承引用字段 + note: inherit from reference field loop: 2 prefix: "=" postfix: "-" \ No newline at end of file diff --git a/test/script/ddlToYaml.exp b/test/script/ddlToYaml.exp index d8efdba8049e2565b6a073cd46dbc6ef4204500b..509d8337f0db72d97d738bf9076065f255a8f8d9 100644 --- a/test/script/ddlToYaml.exp +++ b/test/script/ddlToYaml.exp @@ -1 +1,2 @@ ->> '192.168.0.1-192.168.1.2' \ No newline at end of file +>> 104 +>> field: id \ No newline at end of file diff --git a/test/script/ddlToYaml.php b/test/script/ddlToYaml.php old mode 100644 new mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..3018596f51d626eefe031fe0b68b85d0e173be9e --- a/test/script/ddlToYaml.php +++ b/test/script/ddlToYaml.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +> + 2. line of id field >> +[esac] +*/ + +$output = []; +exec('./zd-mac -i ../test/definition/_ddl.sql -o ../test/output', $output); +$str = join("\n", $output); +print("$str\n"); + +$content = file_get_contents('../test/output/zt_action.yaml'); +$arr = explode("\n", $content); +$count = sprintf("%d", count($arr)); +print(">> $count\n"); + +$line = $arr[5]; +print(">> $line\n"); \ No newline at end of file diff --git a/test/script/fieldInherit.php b/test/script/fieldInherit.php index f7c34a05cc1425f845bebaae0c9fcdd58df1e755..fbbc0096e5999a5c788494a170d668134590e84a 100755 --- a/test/script/fieldInherit.php +++ b/test/script/fieldInherit.php @@ -2,7 +2,7 @@