Skip to content

Commit

Permalink
test_console_adapter: Add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie committed Jan 5, 2023
1 parent 3bf86c3 commit 1d4990c
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion test/log/test_console_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,42 @@ def test_expected_log_levels
warn: :warn,
error: :error,
fatal: :fatal)
def test_one_message(level)
def test_string_subject(level)
@console_logger.send(level, "subject")
assert_equal(["#{@timestamp_str} [#{level}]: 0.0s: subject\n"],
@logdev.logs)
end

data(debug: :debug,
info: :info,
warn: :warn,
error: :error,
fatal: :fatal)
def test_args(level)
@console_logger.send(level, "subject", 1, 2, 3)
assert_equal([
"#{@timestamp_str} [#{level}]: 0.0s: subject\n" +
" | 1\n" +
" | 2\n" +
" | 3\n"
],
@logdev.logs)
end

data(debug: :debug,
info: :info,
warn: :warn,
error: :error,
fatal: :fatal)
def test_options(level)
@console_logger.send(level, "subject", kwarg1: "opt1", kwarg2: "opt2")
assert_equal([
"#{@timestamp_str} [#{level}]: 0.0s: subject\n" +
" | {\"kwarg1\":\"opt1\",\"kwarg2\":\"opt2\"}\n"
],
@logdev.logs)
end

data(debug: :debug,
info: :info,
warn: :warn,
Expand Down

0 comments on commit 1d4990c

Please sign in to comment.