MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / test_lua

Function test_lua

tests/languages/lua_test.py:17–47  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

15
16
17def test_lua(tmp_path): # pragma: win32 no cover
18 rockspec = '''\
19package = "hello"
20version = "dev-1"
21
22source = {
23 url = "git+ssh://git@github.com/pre-commit/pre-commit.git"
24}
25description = {}
26dependencies = {}
27build = {
28 type = "builtin",
29 modules = {},
30 install = {
31 bin = {"bin/hello-world-lua"}
32 },
33}
34'''
35 hello_world_lua = '''\
36#!/usr/bin/env lua
37print('hello world')
38'''
39 tmp_path.joinpath('hello-dev-1.rockspec').write_text(rockspec)
40 bin_dir = tmp_path.joinpath('bin')
41 bin_dir.mkdir()
42 bin_file = bin_dir.joinpath('hello-world-lua')
43 bin_file.write_text(hello_world_lua)
44 make_executable(bin_file)
45
46 expected = (0, b'hello world\n')
47 assert run_language(tmp_path, lua, 'hello-world-lua') == expected
48
49
50def test_lua_additional_dependencies(tmp_path): # pragma: win32 no cover

Callers

nothing calls this directly

Calls 2

make_executableFunction · 0.90
run_languageFunction · 0.90

Tested by

no test coverage detected