2017-06-14 61 views
0

我使用黃瓜和崇高文本3來創建一些測試用例,但是當我嘗試爲它們創建代碼段時,行爲與預期不同,當我使用選項卡調用代碼段時按鈕沒有發生。我必須弄清楚會發生什麼,並且我發現代碼中的問題是步驟描述中的$。

我的片段:

<snippet> 
    <content><![CDATA[ 
    'use strict'; 

    module.exports = function() { 

    var Given = this.Given, 
     When = this.When, 
     Then = this.Then; 

    Given(/^description$/, function(cb) { 
     cb(); 
    }); 

    When(/^description$/, function(cb) { 
     cb(); 
    }); 

    Then(/^description$/, function(cb) { 
     cb(); 
    }); 
    }; 
    ]]></content> 
    <tabTrigger>step</tabTrigger> 
    <scope>source.js</scope> 
    <description>To create a step in cucumber</description> 
</snippet> 

然後當我刪除步驟的片段工作非常精細的描述$,但我需要在這一步象徵。我在這種情況下做什麼?

+0

[Latex Sublime snippet]的可能重複(https://stackoverflow.com/questions/40481224/latex-sublime-snippet) –

回答

0

步驟描述中的$符號表示故事線的結束。如果您想使用逃生符號,則需要將其轉義。例如,

Given("^Unit price is 50\$ currently$") 

如果我們使用^在開始和結束時$然後黃瓜會爲故事和定義精確匹配。