From 475d70b4982fdad999a61ffc5e1dfe41fe33a923 Mon Sep 17 00:00:00 2001 From: toshimaru Date: Thu, 14 Dec 2023 04:46:20 +0900 Subject: [PATCH] test: Add tests for RDoc::TokenStream#add_tokens, add_token ,collect_tokens and pop_token --- test/rdoc/test_rdoc_token_stream.rb | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/test/rdoc/test_rdoc_token_stream.rb b/test/rdoc/test_rdoc_token_stream.rb index 4a0ddb9fec..8fcd3d8f68 100644 --- a/test/rdoc/test_rdoc_token_stream.rb +++ b/test/rdoc/test_rdoc_token_stream.rb @@ -39,6 +39,42 @@ def test_class_to_html_empty assert_equal '', RDoc::TokenStream.to_html([]) end + def test_add_tokens + foo = Class.new do + include RDoc::TokenStream + end.new + foo.collect_tokens + foo.add_tokens([:token]) + assert_equal [:token], foo.token_stream + end + + def test_add_token + foo = Class.new do + include RDoc::TokenStream + end.new + foo.collect_tokens + foo.add_token(:token) + assert_equal [:token], foo.token_stream + end + + def test_collect_tokens + foo = Class.new do + include RDoc::TokenStream + end.new + foo.collect_tokens + assert_equal [], foo.token_stream + end + + def test_pop_token + foo = Class.new do + include RDoc::TokenStream + end.new + foo.collect_tokens + foo.add_token(:token) + foo.pop_token + assert_equal [], foo.token_stream + end + def test_token_stream foo = Class.new do include RDoc::TokenStream