FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pre-commit/tests/languages/lua_test.py at main · pre-commit/pre-commit · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
pre-commit
/
pre-commit
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
1k
Star
15.5k
Code
Issues
18
Pull requests
8
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
pre-commit
/
tests
/
languages
/
lua_test.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (48 loc) · 1.3 KB
Breadcrumbs
pre-commit
/
tests
/
languages
/
lua_test.py
Copy path
File metadata and controls
58 lines (48 loc) · 1.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from
__future__
import
annotations
import
sys
import
pytest
from
pre_commit
.
languages
import
lua
from
pre_commit
.
util
import
make_executable
from
testing
.
language_helpers
import
run_language
pytestmark
=
pytest
.
mark
.
skipif
(
sys
.
platform
==
'win32'
,
reason
=
'lua is not supported on windows'
,
)
def
test_lua
(
tmp_path
):
# pragma: win32 no cover
rockspec
=
'''
\
package = "hello"
version = "dev-1"
source = {
url = "git+ssh://git@github.com/pre-commit/pre-commit.git"
}
description = {}
dependencies = {}
build = {
type = "builtin",
modules = {},
install = {
bin = {"bin/hello-world-lua"}
},
}
'''
hello_world_lua
=
'''
\
#!/usr/bin/env lua
print('hello world')
'''
tmp_path
.
joinpath
(
'hello-dev-1.rockspec'
).
write_text
(
rockspec
)
bin_dir
=
tmp_path
.
joinpath
(
'bin'
)
bin_dir
.
mkdir
()
bin_file
=
bin_dir
.
joinpath
(
'hello-world-lua'
)
bin_file
.
write_text
(
hello_world_lua
)
make_executable
(
bin_file
)
expected
=
(
0
,
b'hello world
\n
'
)
assert
run_language
(
tmp_path
,
lua
,
'hello-world-lua'
)
==
expected
def
test_lua_additional_dependencies
(
tmp_path
):
# pragma: win32 no cover
ret
,
out
=
run_language
(
tmp_path
,
lua
,
'luacheck --version'
,
deps
=
(
'luacheck'
,),
)
assert
ret
==
0
assert
out
.
startswith
(
b'Luacheck: '
)
Back
|
FazBrowse Home
|
New Git URL