Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 为什么赢了';这次考试不及格吗?_Ruby_Unit Testing_Syntax Error - Fatal编程技术网

Ruby 为什么赢了';这次考试不及格吗?

Ruby 为什么赢了';这次考试不及格吗?,ruby,unit-testing,syntax-error,Ruby,Unit Testing,Syntax Error,在调试这个Ruby单元测试时遇到了麻烦,但不知道我做错了什么。代码如下: 我的问题是最好的句子选择方法;以下是Textmate给我的回复: 你能帮忙吗?谢谢大家! 在这条线上 WordPlay.best_sentence(['This is a test', 'This is another test', 'This is a great test'] %w{test great this})) 第一个参数后似乎没有逗号。然后有两个右括号,但只有一个左括号 请考虑编辑您的问题,使代码更可读(提

在调试这个Ruby单元测试时遇到了麻烦,但不知道我做错了什么。代码如下:

我的问题是最好的句子选择方法;以下是Textmate给我的回复: 你能帮忙吗?谢谢大家! 在这条线上

WordPlay.best_sentence(['This is a test', 'This is another test', 'This is a great test'] %w{test great this}))
第一个参数后似乎没有逗号。然后有两个右括号,但只有一个左括号


请考虑编辑您的问题,使代码更可读(提示:如果一行从4个空格开始,前面是一个空行,它看起来像代码)。< /P>请正确地格式化您的代码。
    /Users/pdenlinger/ruby/wordplaylib/wordplaytest.rb:23: syntax error, unexpected tQWORDS_BEG, expecting ')'
              %w{test great this}))
                 ^
/Users/pdenlinger/ruby/wordplaylib/wordplaytest.rb:23: syntax error, unexpected ')', expecting kEND
              %w{test great this}))
                                  ^
WordPlay.best_sentence(['This is a test', 'This is another test', 'This is a great test'] %w{test great this}))