Fitnesse Slim:如何连接符号 [英] Fitnesse Slim: How to concatenate symbol
问题描述
如何将符号与两侧的文字连接起来?
例如:
How would one concatenate a symbol with text on either side? For example:
- 前缀:
GAR _
- 变量:
$ todayDate
- 后缀:
_ 1
- Prefix:
"GAR_"
- Variable:
$todayDate
- Suffix:
"_1"
GAR_ $ todayDate_1
评估为:
GAR_07202012_1
运行测试时在fitnesse中,似乎串联正在工作( GAR_ $ todayDate-> [07202012] _1
)。但是,我将此值作为参数传递给Visual Studio,而是以以下文本结尾: GAR_ $ todayDate_1
。
When running the test in fitnesse, it seems as though the concatenation is working (GAR_$todayDate->[07202012]_1
). However, I am passing this value as a parameter to visual studio and I instead end up with the following text: GAR_$todayDate_1
.
当我删除后缀或在 $ todayDate
和 _ 1
之间放置空格时,一切正常
When I remove the suffix or put a space between $todayDate
and "_1"
, everything works as expected.
任何帮助将不胜感激。
我尝试过的事情:
-
GAR _!-$ todayDate-!_ 1
-
GAR_ $ todayDate!-_ 1-!
-
GAR_ $ todayDate $ {SUFFIX}
-定义了静态变量
GAR_!-$todayDate-!_1
GAR_$todayDate!-_1-!
GAR_$todayDate${SUFFIX}
- static variable defined
谢谢,
迈克
推荐答案
我目前仍然遇到相同的问题。
我发现的唯一方法是:
I am stuck with the same problem currently. The only way I found was to:
- 创建
StringSupport
带有String concatenate(String s1,String s2)
方法 -
import
FitNesse测试中该类的软件包 - 将
StringSupport
放入FitNesse测试中可用库中的库
表 - 在您的
脚本
中,您现在可以执行以下操作:| $ result = | concatenate; | $ s1 | $ s2 |
- create a
StringSupport
class with aString concatenate(String s1, String s2)
method import
the package of that class in your FitNesse test- put
StringSupport
in the available libraries in your FitNesse test with theLibrary
table - in your
Script
, you can now do:|$result=|concatenate;|$s1|$s2|
适合您的确切用例,则只需使用3个字符串而不是一个字符串来执行相同的concatenate()。
To fit your exact use case, you just have to do the same concatenate() with 3 strings instead of just one.
这篇关于Fitnesse Slim:如何连接符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!