Testing 使用带字符串的缩进
Cucumber从我的场景中删除了压痕:Testing 使用带字符串的缩进,testing,cucumber,Testing,Cucumber,Cucumber从我的场景中删除了压痕: Scenario: view task info with subtasks When I run command `-t 1 list` Then I should see """ #1 "Test task 1" 2014-11-12 Description 1 Subtasks: 2014-11-12 Subtask 3 (#3) #this indentation
Scenario: view task info with subtasks
When I run command `-t 1 list`
Then I should see
"""
#1 "Test task 1"
2014-11-12
Description 1
Subtasks:
2014-11-12 Subtask 3 (#3) #this indentation
2014-11-12 Subtask 1 (#1) #stripped away
"""
通过实验我发现,Cucumber去掉了4个或3个前导空格。所以,如果我需要在代码中测试两个空格缩进,我需要在场景中放置六到五个空格。这很奇怪。Cucumber的行为是否正确?Cucumber应该删除与开头三引号使用的缩进量相同的缩进量。如果将关键字右对齐,通常会出现缩进量不同的情况,如下所示:
Given
When
Then
And
现在的行为也是:
单据字符串的每一行都将根据期初缩进。因此,将保留开口柱以外的压痕