blob: 5a4497d253a892f7673f8e27ac28da72d6b348f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env ruby
# coding: utf-8
require "test_helper"
require "highline/question"
class TestAnswerConverter < Minitest::Test
def test_integer_convertion
question = HighLine::Question.new("What's your age?", Integer)
question.answer = "18"
answer_converter = HighLine::Question::AnswerConverter.new(question)
refute_equal "18", answer_converter.convert
assert_equal 18, answer_converter.convert
end
def test_float_convertion
question = HighLine::Question.new("Write PI", Float)
question.answer = "3.14159"
answer_converter = HighLine::Question::AnswerConverter.new(question)
refute_equal "3.14159", answer_converter.convert
assert_equal 3.14159, answer_converter.convert
end
end
|