Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 14, 2025

  • plenary.nvimのbusted形式でテストディレクトリを作成
  • utils/list.luaのin-source testingをtests/utils/list_spec.luaに移行
  • utils/functions.luaのin-source testingをtests/utils/functions_spec.luaに移行
  • utils/functions/s.luaのin-source testingをtests/utils/functions/s_spec.luaに移行
  • utils/pipe.luaのin-source testingをtests/utils/pipe_spec.luaに移行
  • 元のファイルからin-source testingコードを削除
  • ファイル末尾に残っていた「-- In-source testing」コメントを削除
  • functions_spec.luaの変数名をコードベースの慣例に合わせてFunctionsからfnに変更
  • utils.testモジュールを削除し、関数を使用箇所に移動
  • テスト実行用のスクリプトとminimal_init.luaを作成
  • テストディレクトリのREADME.mdを作成
  • READMEに移行されたファイル一覧の情報を追加

完了した作業

移行されたモジュール(4ファイル)

  1. lua/utils/list.luatests/utils/list_spec.lua
  2. lua/utils/functions.luatests/utils/functions_spec.lua
  3. lua/utils/functions/s.luatests/utils/functions/s_spec.lua
  4. lua/utils/pipe.luatests/utils/pipe_spec.lua

リファクタリング

  • lua/utils/test.luaを削除し、以下のように関数を移動:
    • reduce, concat_array_including_nil, to_element_string, make_array_to_string, is_arrayutils/list.luaに直接実装
    • deep_equalutils/functions.luaに直接実装

すべてのin-source testing (if vim == nil then)ブロックとコメントを削除し、plenary.nvimのbustedテストフレームワークに完全移行しました。コードベースの命名規則に従い、utils.functionsfnとして代入しています。

utils.testモジュールは不要になったため削除し、その関数群は実際に使用されているutils.listとutils.functionsに直接実装しました。

Fixes #60

Original prompt

This section details on the original issue you should resolve

<issue_title>Neovim: in-source testingをplenary.nvimのbustedに置き換える</issue_title>
<issue_description>SSIA</issue_description>

<agent_instructions>コミットはconventional commitで。
直近のコミット履歴のメッセージを見てくれてもいい。

PR本文は日本語で。</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #60


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 14, 2025 19:41
Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Copilot AI changed the title [WIP] Replace in-source testing with plenary.nvim's busted test: in-source testingをplenary.nvimのbustedに置き換える Oct 14, 2025
Copilot AI requested a review from aiya000 October 14, 2025 19:49
@aiya000 aiya000 marked this pull request as ready for review October 18, 2025 04:47
@aiya000
Copy link
Owner

aiya000 commented Oct 18, 2025

@copilot
--in-source testingのコメントがファイル末端に残っているものがある気がするから、それを削除してもらえる?

@aiya000
Copy link
Owner

aiya000 commented Oct 18, 2025

@copilot
functions_spec.luaで、local Functions = require('utils.functions')local fn = require('utils.functions')の方がよくない?
他ではfnとして代入している箇所が多いんだよね。

Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 18, 2025

@copilot
--in-source testingのコメントがファイル末端に残っているものがある気がするから、それを削除してもらえる?

削除しました。以下の3ファイルの末尾に残っていた-- In-source testingコメントを削除しています:

  • lua/utils/functions.lua
  • lua/utils/pipe.lua
  • lua/utils/functions/s.lua

コミット: [fix: ファイル末尾の残りのin-source testingコメントを削除]

@aiya000
Copy link
Owner

aiya000 commented Oct 18, 2025

@copilot
こうなると、utils.testはいらないかも。
他のモジュールでutils.testをre-exportしている箇所があるので、そちらに移して、utils.testモジュールは消してしまおう。

Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 18, 2025

@copilot
functions_spec.luaで、local Functions = require('utils.functions')local fn = require('utils.functions')の方がよくない?
他ではfnとして代入している箇所が��...

変更しました。コードベースの他の箇所と同じようにfnとして代入するようにしました。

コミット: cf47c63

@aiya000
Copy link
Owner

aiya000 commented Oct 18, 2025

@copilot
ありがとう。
でもneosnippetの更新はいらないかな

@aiya000
Copy link
Owner

aiya000 commented Oct 18, 2025

@copilot
テストの実行結果はどう?

Co-authored-by: aiya000 <4897842+aiya000@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 18, 2025

@copilot
こうなると、utils.testはいらないかも。
他のモジュールでutils.testをre-exportしている箇所があるので、そちらに移して、utils.testモジュールは�...

utils.testモジュールを削除し、関数をutils.listとutils.functionsに移動しました。

  • reduce, concat_array_including_nil, to_element_string, make_array_to_string, is_array → utils.list
  • deep_equal → utils.functions

コミット: (processing)

@copilot
ありがとう。
でもneosnippetの更新はいらないかな

neosnippetの変更を元に戻しました。

コミット: (processing)

Copy link
Contributor Author

Copilot AI commented Oct 18, 2025

@copilot
テストの実行結果はどう?

この環境ではNeovimが利用できないため、実際にテストを実行することはできません。

ただし、以下を確認しました:

  • 4つのテストファイルが正しく作成されています(list_spec.lua, functions_spec.lua, pipe_spec.lua, functions/s_spec.lua)
  • 各テストファイルは正しい構造で、対応するモジュールをrequireしています
  • 元のモジュールファイル(list.lua, functions.lua, pipe.lua, s.lua)は正しくreturn文で終わっています

テストを実行するには、ローカル環境で以下のコマンドを実行してください:

cd ~/.config/nvim
nvim --headless -c "PlenaryBustedDirectory tests/ { minimal_init = 'tests/minimal_init.lua' }" -c "qa"

または:

cd ~/.config/nvim
./run_tests.sh

@aiya000 aiya000 force-pushed the main branch 3 times, most recently from dd42220 to 17e6373 Compare October 30, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Neovim: in-source testingをplenary.nvimのbustedに置き換える

2 participants