나는 Ruby Koans을 통해 진행 중이며 AboutHashes에 있습니다. 지금까지 assert_equals는 assert_equal
공백 expected_value
쉼표 actual value
(예 : assert_equal 2, 1 + 1
)의 특정 서식 스타일을 따랐습니다. 그러나 About Hash의 test_creating_hashes def는이 패턴을 따르지 않는 assert_equal을 가지고 있으며, 패턴을 일치 시키려면 그것을 변경하면 실패합니다. 구체적으로 :assert_equal의 형식/구문이 다른 assert_equals와 다른 이유는 무엇입니까?
그럼이 상황에서 assert_equal
의 특별한 점은 무엇입니까?
시험 실패 메시지의 고기이다 루비 빈 블록 {전달 제로서 예를 파싱 때문에
<internal:lib/rubygems/custom_require>:29:in `require': /Ruby_on_Rails/koans/about_hashes.rb:7: syntax error, unexpected ',', expecting keyword_end (SyntaxError)
assert_equal {}, empty_hash #{} are also used for blocks
^
from <internal:lib/rubygems/custom_require>:29:in `require'
from path_to_enlightenment.rb:10:in `<main>'
흥미로운 경우이지만 테스트 실패 메시지를 보내면 답변하기가 쉽습니다. –