 |
Changeset 3981
- Timestamp:
- 10/07/08 20:11:21
(1 month ago)
- Author:
- Jim Panic
- Message:
Added basic arguments, README file and fixtures block for dtc
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3978 |
r3981 |
|
| 57 | 57 | class Adapter(T) { |
|---|
| 58 | 58 | TestMethod!(T)[] testMethods; |
|---|
| | 59 | T[] fixtures; |
|---|
| 59 | 60 | T[] initialize; |
|---|
| 60 | 61 | T[] finalize; |
|---|
| … | … | |
| 73 | 74 | importStatements ~= token.value; |
|---|
| 74 | 75 | break; |
|---|
| | 76 | |
|---|
| | 77 | case TokenType.FixturesBlock: |
|---|
| | 78 | fixtures = token.value[1..$ - 1]; // skip { and } |
|---|
| 75 | 79 | |
|---|
| 76 | 80 | case TokenType.InitializeCodeBlock: |
|---|
| … | … | |
| 112 | 116 | source ~= "mixin(TestCaseImports!());\n"; |
|---|
| 113 | 117 | source ~= "class " ~ collectionName ~ ": TestCase {\n"; |
|---|
| | 118 | source ~= fixtures ~ "\n"; |
|---|
| 114 | 119 | source ~= "this () {\n"; |
|---|
| 115 | 120 | source ~= "name = \"" ~ collectionName ~ "\";\n"; |
|---|
| r3978 |
r3981 |
|
| 174 | 174 | continue; |
|---|
| 175 | 175 | |
|---|
| | 176 | case "fixtures": |
|---|
| 176 | 177 | case "initialize": |
|---|
| 177 | 178 | case "finalize": |
|---|
| … | … | |
| 187 | 188 | auto codeBlock = consumeDCodeBlock!(T)(source, consumeWhitespace!(T)(source, currentIndex + tokenIdentifier.length)["endWhitespace"]); |
|---|
| 188 | 189 | |
|---|
| | 190 | if (tokenIdentifier == "fixtures") |
|---|
| | 191 | tokenList.addNew(TokenType.FixturesBlock, source[codeBlock["startDCodeBlock"]..codeBlock["endDCodeBlock"]]); |
|---|
| 189 | 192 | if (tokenIdentifier == "initialize") |
|---|
| 190 | 193 | tokenList.addNew(TokenType.InitializeCodeBlock, |
|---|
| r3978 |
r3981 |
|
| 19 | 19 | AfterAnnotation = 9, |
|---|
| 20 | 20 | ThrowsAnnotation = 10, |
|---|
| 21 | | HelperCodeBlock = 11 |
|---|
| | 21 | HelperCodeBlock = 11, |
|---|
| | 22 | FixturesBlock = 12 |
|---|
| 22 | 23 | } |
|---|
| 23 | 24 | |
|---|
| … | … | |
| 37 | 38 | TokenType.AfterAnnotation: "AfterAnnotation", |
|---|
| 38 | 39 | TokenType.ThrowsAnnotation: "ThrowsAnnotation", |
|---|
| 39 | | TokenType.HelperCodeBlock: "HelperCodeBlock" |
|---|
| | 40 | TokenType.HelperCodeBlock: "HelperCodeBlock", |
|---|
| | 41 | TokenType.FixturesBlock: "FixturesBlock" |
|---|
| 40 | 42 | ]; |
|---|
| 41 | 43 | } |
|---|
| r3978 |
r3981 |
|
| 6 | 6 | tango.io.File, |
|---|
| 7 | 7 | tango.io.FilePath, |
|---|
| 8 | | tango.io.FileScan; |
|---|
| | 8 | tango.io.FileScan, |
|---|
| | 9 | tango.io.Print; |
|---|
| 9 | 10 | |
|---|
| 10 | 11 | import tango.io.device.FileConduit; |
|---|
| 11 | 12 | |
|---|
| 12 | | import tango.io.Print; |
|---|
| 13 | 13 | |
|---|
| 14 | 14 | import tango.sys.Environment, |
|---|
| … | … | |
| 21 | 21 | import tango.time.Time; |
|---|
| 22 | 22 | |
|---|
| | 23 | import tango.util.ArgParser; |
|---|
| | 24 | |
|---|
| 23 | 25 | import tango.test.dtcc.Adapter, |
|---|
| 24 | 26 | tango.test.dtcc.Lexer; |
|---|
| 25 | 27 | |
|---|
| 26 | | private void convertDtc(T)(FilePath dtcFile, FilePath dFile) { |
|---|
| | 28 | import tango.test.suite.Config; |
|---|
| | 29 | |
|---|
| | 30 | void convertDtc(T)(FilePath dtcFile, FilePath dFile) { |
|---|
| 27 | 31 | scope lexer = new Lexer!(T)(dtcFile.toString); |
|---|
| 28 | 32 | scope adapter = new Adapter!(char)(lexer.tokenList.tokens[0]); |
|---|
| … | … | |
| 77 | 81 | private char[] skeletonName; |
|---|
| 78 | 82 | |
|---|
| 79 | | public this (char[] testExeName, char[] baseDir, char[] file) { |
|---|
| | 83 | public this (char[] testExeName, char[] file, Config cfg) { |
|---|
| 80 | 84 | testCasesFile = file; |
|---|
| 81 | | testCasesBaseDir = baseDir; |
|---|
| | 85 | testCasesBaseDir = cfg.baseDir; |
|---|
| 82 | 86 | skeletonName = testExeName; |
|---|
| 83 | 87 | |
|---|
| … | … | |
| 217 | 221 | } |
|---|
| 218 | 222 | |
|---|
| | 223 | char[] _version = "0.1"; |
|---|
| | 224 | char[] usage = "tango.test TestSuite version {1} |
|---|
| | 225 | Usage: {0} [--help]"; |
|---|
| | 226 | |
|---|
| 219 | 227 | void main (char[][] args) { |
|---|
| 220 | | auto suite = new TestSuite("tango.test", "test_collections", "testcasesfile__"); |
|---|
| | 228 | auto parser = new ArgParser; |
|---|
| | 229 | auto build = true; |
|---|
| | 230 | Config cfg; |
|---|
| | 231 | |
|---|
| | 232 | cfg.buildTool = "rebuild"; |
|---|
| | 233 | cfg.baseDir = "TestCollections"; |
|---|
| | 234 | |
|---|
| | 235 | parser.bindPosix("help", (char[] value) { |
|---|
| | 236 | Stdout.formatln(usage, args[0], _version); |
|---|
| | 237 | build = false; |
|---|
| | 238 | }); |
|---|
| | 239 | |
|---|
| | 240 | parser.bindPosix("base-dir", (char[] value) { cfg.baseDir = value; }); |
|---|
| | 241 | parser.bindPosix("build-tool", (char[] value) { cfg.buildTool = value; }); |
|---|
| | 242 | |
|---|
| | 243 | parser.parse(args[1..$]); |
|---|
| | 244 | |
|---|
| | 245 | if (!build) { return; } |
|---|
| | 246 | |
|---|
| | 247 | auto suite = new TestSuite("tango.test", "testcasesfile__", cfg); |
|---|
| 221 | 248 | suite.run; |
|---|
| 222 | 249 | } |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic