Решение на Втора задача - хешове, масиви и структура от Валентин Георгиев
Обратно към всички решения
Към профила на Валентин Георгиев
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 11 успешни тест(а)
- 4 неуспешни тест(а)
Код
Лог от изпълнението
F...FF.F.......
Failures:
1) Task 2 README works for all examples
Failure/Error: expect(dessert.fetch_deep('variant')).to eq('chocolate')
expected: "chocolate"
got: nil
(compared using ==)
# /tmp/d20161024-13689-1kmop13/spec.rb:25:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
2) Task 2 Hash#fetch_deep returns nil for non-existant keys
Failure/Error: expect(input.fetch_deep('meal.0.type')).to be nil
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20161024-13689-1kmop13/solution.rb:8:in `block in fetch_deep'
# /tmp/d20161024-13689-1kmop13/solution.rb:6:in `each'
# /tmp/d20161024-13689-1kmop13/solution.rb:6:in `fetch_deep'
# /tmp/d20161024-13689-1kmop13/spec.rb:89:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
3) Task 2 Hash#fetch_deep is indifferent to symbols and strings
Failure/Error: expect(input.fetch_deep('dessert')).to eq 'ice cream'
expected: "ice cream"
got: nil
(compared using ==)
# /tmp/d20161024-13689-1kmop13/spec.rb:96:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
4) Task 2 Hash#fetch_deep can fetch integer-like keys from hashes
Failure/Error: expect(input.fetch_deep('nested.1')).to eq :a
expected: :a
got: nil
(compared using ==)
# /tmp/d20161024-13689-1kmop13/spec.rb:111:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
Finished in 0.00806 seconds
15 examples, 4 failures
Failed examples:
rspec /tmp/d20161024-13689-1kmop13/spec.rb:3 # Task 2 README works for all examples
rspec /tmp/d20161024-13689-1kmop13/spec.rb:85 # Task 2 Hash#fetch_deep returns nil for non-existant keys
rspec /tmp/d20161024-13689-1kmop13/spec.rb:92 # Task 2 Hash#fetch_deep is indifferent to symbols and strings
rspec /tmp/d20161024-13689-1kmop13/spec.rb:108 # Task 2 Hash#fetch_deep can fetch integer-like keys from hashes
История (1 версия и 0 коментара)
Валентин обнови решението на 23.10.2016 16:30 (преди около 8 години)