Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3981

Show
Ignore:
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
  • branches/tango.test/tango/test/dtcc/Adapter.d

    r3978 r3981  
    5757class Adapter(T) { 
    5858    TestMethod!(T)[] testMethods; 
     59    T[]              fixtures; 
    5960    T[]              initialize; 
    6061    T[]              finalize; 
     
    7374                    importStatements ~= token.value; 
    7475                    break; 
     76 
     77                case TokenType.FixturesBlock: 
     78                    fixtures = token.value[1..$ - 1]; // skip { and } 
    7579 
    7680                case TokenType.InitializeCodeBlock: 
     
    112116        source ~= "mixin(TestCaseImports!());\n"; 
    113117        source ~= "class " ~ collectionName ~ ": TestCase {\n"; 
     118        source ~= fixtures ~ "\n"; 
    114119        source ~= "this () {\n"; 
    115120        source ~= "name = \"" ~ collectionName ~ "\";\n"; 
  • branches/tango.test/tango/test/dtcc/Lexer.d

    r3978 r3981  
    174174                    continue; 
    175175 
     176                case "fixtures": 
    176177                case "initialize": 
    177178                case "finalize": 
     
    187188                    auto codeBlock = consumeDCodeBlock!(T)(source, consumeWhitespace!(T)(source, currentIndex + tokenIdentifier.length)["endWhitespace"]); 
    188189 
     190                    if (tokenIdentifier == "fixtures") 
     191                        tokenList.addNew(TokenType.FixturesBlock, source[codeBlock["startDCodeBlock"]..codeBlock["endDCodeBlock"]]); 
    189192                    if (tokenIdentifier == "initialize") 
    190193                        tokenList.addNew(TokenType.InitializeCodeBlock, 
  • branches/tango.test/tango/test/dtcc/Token.d

    r3978 r3981  
    1919    AfterAnnotation = 9, 
    2020    ThrowsAnnotation = 10, 
    21     HelperCodeBlock = 11 
     21    HelperCodeBlock = 11, 
     22    FixturesBlock = 12 
    2223} 
    2324 
     
    3738        TokenType.AfterAnnotation: "AfterAnnotation", 
    3839        TokenType.ThrowsAnnotation: "ThrowsAnnotation", 
    39         TokenType.HelperCodeBlock: "HelperCodeBlock" 
     40        TokenType.HelperCodeBlock: "HelperCodeBlock", 
     41        TokenType.FixturesBlock: "FixturesBlock" 
    4042    ]; 
    4143} 
  • branches/tango.test/tango/test/suite/TestSuite.d

    r3978 r3981  
    66       tango.io.File, 
    77       tango.io.FilePath, 
    8        tango.io.FileScan; 
     8       tango.io.FileScan, 
     9       tango.io.Print; 
    910 
    1011import tango.io.device.FileConduit; 
    1112 
    12 import tango.io.Print; 
    1313 
    1414import tango.sys.Environment, 
     
    2121import tango.time.Time; 
    2222 
     23import tango.util.ArgParser; 
     24 
    2325import tango.test.dtcc.Adapter, 
    2426       tango.test.dtcc.Lexer; 
    2527 
    26 private void convertDtc(T)(FilePath dtcFile, FilePath dFile) { 
     28import tango.test.suite.Config; 
     29 
     30void convertDtc(T)(FilePath dtcFile, FilePath dFile) { 
    2731    scope lexer = new Lexer!(T)(dtcFile.toString); 
    2832    scope adapter = new Adapter!(char)(lexer.tokenList.tokens[0]); 
     
    7781    private char[]           skeletonName; 
    7882 
    79     public this (char[] testExeName, char[] baseDir, char[] file) { 
     83    public this (char[] testExeName, char[] file, Config cfg) { 
    8084        testCasesFile = file; 
    81         testCasesBaseDir = baseDir; 
     85        testCasesBaseDir = cfg.baseDir; 
    8286        skeletonName = testExeName; 
    8387 
     
    217221} 
    218222 
     223char[] _version = "0.1"; 
     224char[] usage = "tango.test TestSuite version {1} 
     225Usage: {0} [--help]"; 
     226 
    219227void 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); 
    221248    suite.run; 
    222249}