2017-06-22 49 views
0

我有几个测试,我使用Rspec运行。如何在Rspec控制台输出的测试之间添加换行符?

输出结果看起来大概如下:

returns an array containing partial words that have changed their case(upper/lower), 
and have matching partial words in opposite elements(ins/del) 
returns an array containing words that have changed their case(upper/lower), 
and have matching whole words in opposite elements(ins/del) 
returns an array containing words that have changed their case(upper/lower), are at the start of a sentence, 
and have matching words in opposite elements(ins/del) 
returns an array containing partial words that have changed their case(uppler/lower), have matching partial words in opposite elements(ins/del), 
and are preceded by an inserted word 

我想有一个换行分隔每个测试,使其更容易为我读输出。我曾尝试添加“\ n”,但它似乎不起作用。

任何想法?

+0

您在哪里试图放置'\ n'? –

+0

我把它放在测试说明的末尾。例如它“返回一个数组... \ n”但这不起作用 – chell

+0

如果它是在双引号'“\ n”'它应该可能工作... –

回答

0

可以使用红宝石输出命令打印或看跌期权,以获得测试 打印期权和看跌期权之间的差异之间的换行,打印不会自动给换行,但看跌期权会自动给 下面是示例代码

print "test = ", variable , ".\n" 
puts "test = ", variable 

上述两个命令都会在执行每个命令后给出换行符

+0

我会在哪里把它放在Rspec测试中? – chell

相关问题