Informative error message when `LoadFile` fails

オープン
#18 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
go, lua
領域
testing-qa

調査の方向性

The generic file error comes from the script-loading step in lua_test_runner.go around line 31, which hides the underlying error from the Lua load call. Start there and check what error value the load returns for a missing file versus a syntax error. Done when RunLuaTests reports the actual cause (the file path or the Lua syntax message) for both cases, and the two failure cases in the issue print distinct messages.

索引モデルが issue の本文から書いたものです。

説明

enhancement

Proposed solution

Provide more context as to what failed with the call.

Problem

At this time, both a syntax error or a missing file show up as file error:

Missing file:

func TestLuaRegexp(t *testing.T) {
    l := lua.NewState()
    lua.OpenLibraries(l)
    regexp.Open(l)
    luatest.RunLuaTests(t, l, "im_not_a_file.lua")
    // luatest.RunLuaTests(t, l, "regexp_test.lua")
}
// --- FAIL: TestLuaRegexp (0.00 seconds)
//         lua_test_runner.go:31: loading lua test script in VM, file error

Syntax error (in regexp_test.lua):

local re = require("goluago/regexp")

derp!

-- quotemeta
equals("quotemeta: example", "\\[foo\\]", re.quotemeta("[foo]"))
func TestLuaRegexp(t *testing.T) {
    l := lua.NewState()
    lua.OpenLibraries(l)
    regexp.Open(l)
    luatest.RunLuaTests(t, l, "regexp_test.lua")
}
// --- FAIL: TestLuaRegexp (0.00 seconds)
//         lua_test_runner.go:31: loading lua test script in VM, file error
主要言語
Go
スター
3.5k
フォーク
217
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Shopify/go-lua のほかの issue

Shopify/go-lua の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。