Skip to content

Commit

Permalink
chore: cleanup editorconfig file and fix indetation in bats file
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-cristino authored and jaromil committed Dec 14, 2024
1 parent 7a9e72e commit 8f960b4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 55 deletions.
36 changes: 2 additions & 34 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,14 @@ end_of_line = lf
insert_final_newline = true
charset = utf-8


[**/*.[ch]]
indent_style = tab
indent_size = 8

[Makefile]
indent_style = tab

[src/lua/*.lua]
indent_style = space
indent_size = 4

[test/**/*.lua]
indent_style = space
indent_size = 4

[test/**/*.bats]
indent_style = space
indent_size = 4

[src/lua/crypto_ethereum.lua]
indent_style = space
indent_size = 3

[src/lua/zencode.lua]
indent_style = tab
indent_size = 4

[src/lua/zencode_array.lua]
indent_style = tab
indent_size = 4

[src/lua/zencode_data.lua]
indent_style = space
indent_size = 2

[**/*.go]
[GNUMakefile]
indent_style = tab
indent_size = 4

[docs/doc_needed/*.lua]
[test/*.bats]
indent_style = space
indent_size = 4
12 changes: 5 additions & 7 deletions test/cli.bats
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,30 @@ load bats_setup
}

@test "Pass pre-processor defines" {
run ${CJIT} -q test/cflags.c -DALLOWED
run ${CJIT} -q test/cflags.c -DALLOWED
assert_success
assert_output 'Success.'
run ${CJIT} -q test/cflags.c -DALLOWED=1
run ${CJIT} -q test/cflags.c -DALLOWED=1
assert_success
assert_output 'Success.'
run ${CJIT} -q test/cflags.c
run ${CJIT} -q test/cflags.c
assert_failure
assert_output --partial 'Please compile with -DALLOWED=1'
}

@test "Execute multiple files" {
run ${CJIT} -q test/multifile/*
run ${CJIT} -q test/multifile/*
assert_success
assert_line --partial 'hello from myfunc'
assert_line --partial 'hello from myfunc2'
assert_line --partial 'hello from myfunc3'

}

@test "Pass arguments to executed source" {
run ${CJIT} -q test/cargs.c -- a b c
run ${CJIT} -q test/cargs.c -- a b c
assert_success
assert_line --partial '0: test/cargs.c'
assert_line --partial '1: a'
assert_line --partial '2: b'
assert_line --partial '3: c'

}
28 changes: 14 additions & 14 deletions test/windows.bats
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ load bats_setup
@test "Timeb.h inclusion for clock() in Windows" {
# see https://www.reddit.com/r/C_Programming/comments/1h1g4gc/comment/lzc9fta/
# /sys/timeb.h:132: error: include file 'sec_api/sys/timeb_s.h' not found
run ${CJIT} test/win_timeb.c
assert_success
run ${CJIT} test/win_timeb.c
assert_success
}

@test "BOM source file UTF8" {
run ${CJIT} -q test/hello-bom-utf8.c
assert_failure
assert_line --partial 'UTF BOM detected in file: test/hello-bom-utf8.c'
assert_line --partial 'Encoding is not yet supported, execution aborted.'
run ${CJIT} -q test/hello-bom-utf8.c
assert_failure
assert_line --partial 'UTF BOM detected in file: test/hello-bom-utf8.c'
assert_line --partial 'Encoding is not yet supported, execution aborted.'
}

@test "BOM source file UTF16 big endian" {
run ${CJIT} -q test/hello-bom-utf16-be.c
assert_failure
assert_line --partial 'UTF BOM detected in file: test/hello-bom-utf16-be.c'
assert_line --partial 'Encoding is not yet supported, execution aborted.'
run ${CJIT} -q test/hello-bom-utf16-be.c
assert_failure
assert_line --partial 'UTF BOM detected in file: test/hello-bom-utf16-be.c'
assert_line --partial 'Encoding is not yet supported, execution aborted.'
}

@test "BOM source file UTF16 little endian" {
run ${CJIT} -q test/hello-bom-utf16-le.c
assert_failure
assert_line --partial 'UTF BOM detected in file: test/hello-bom-utf16-le.c'
assert_line --partial 'Encoding is not yet supported, execution aborted.'
run ${CJIT} -q test/hello-bom-utf16-le.c
assert_failure
assert_line --partial 'UTF BOM detected in file: test/hello-bom-utf16-le.c'
assert_line --partial 'Encoding is not yet supported, execution aborted.'
}

0 comments on commit 8f960b4

Please sign in to comment.