Changeset 298

Show
Ignore:
Timestamp:
02/16/08 17:09:23 (5 months ago)
Author:
ingy
Message:
Adding delim support
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/ingy/JS-Test-Base/lib/Test/Base.js

    r296 r298  
    1313    this.state.filters_map = {}; 
    1414    this.state.blocks = []; 
     15    this.block_delim = '==='; 
     16    this.section_delim = '---'; 
    1517} 
    1618 
     
    111113 
    112114    var chunks = []; 
    113     while (hunk.indexOf('\n---') >= 0) { 
    114         index = hunk.indexOf('\n---') + 1; 
     115    var delim = this.section_delim; 
     116    while (hunk.indexOf('\n' + delim) >= 0) { 
     117        index = hunk.indexOf('\n' + delim) + 1; 
    115118        var chunk = hunk.substr(0, index); 
    116119        hunk = hunk.substr(index); 
     
    119122    chunks.push(hunk); 
    120123 
     124    delim = delim.replace(/[\+]/g, '\\+'); 
    121125    for (var i = 0; i < chunks.length; i++) { 
    122126        var chunk = chunks[i]; 
     
    125129        var line1 = chunk.substr(0, index); 
    126130        var section_data = chunk.substr(index + 1); 
    127         line1 = line1.replace(/^---\s*/, ''); 
     131        line1 = line1.replace(new RegExp('^' + delim + '\\s*'), ''); 
    128132        if (! line1.length) throw('xxx2'); 
    129133        var section_name = '';