Skip to content

Commit

Permalink
Test negative
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscerie committed Dec 2, 2023
1 parent 02c9d65 commit d2e3e49
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
3 changes: 3 additions & 0 deletions selene-lib/tests/lints/approx_constant/approx_constant.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local good = 3
local good = 3.1
local good = 3.13
local good = 3.15
local good = -3.15
local good = 3.1417
local good = 3.14159266

Expand All @@ -10,9 +11,11 @@ local good = 3_14

local bad = 3.14
local bad = 3.141
local bad = -3.141
local bad = 3.142
local bad = 3.1415
local bad = 3.14159265

local bad = 3.14 + 1
local bad = f(3.14 + 1)
local bad = f(-3.14 + 1)
40 changes: 26 additions & 14 deletions selene-lib/tests/lints/approx_constant/approx_constant.stderr
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:11:13
┌─ approx_constant.lua:12:13
11 │ local bad = 3.14
12 │ local bad = 3.14
│ ^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:12:13
┌─ approx_constant.lua:13:13
12 │ local bad = 3.141
13 │ local bad = 3.141
│ ^^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:13:13
┌─ approx_constant.lua:14:14
14 │ local bad = -3.141
│ ^^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:15:13
13 │ local bad = 3.142
15 │ local bad = 3.142
│ ^^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:14:13
┌─ approx_constant.lua:16:13
14 │ local bad = 3.1415
16 │ local bad = 3.1415
│ ^^^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:15:13
┌─ approx_constant.lua:17:13
15 │ local bad = 3.14159265
17 │ local bad = 3.14159265
│ ^^^^^^^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:17:13
┌─ approx_constant.lua:19:13
17 │ local bad = 3.14 + 1
19 │ local bad = 3.14 + 1
│ ^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:18:15
┌─ approx_constant.lua:20:15
18 │ local bad = f(3.14 + 1)
20 │ local bad = f(3.14 + 1)
│ ^^^^

error[approx_constant]: `math.pi` is more precise
┌─ approx_constant.lua:21:16
21 │ local bad = f(-3.14 + 1)
│ ^^^^

0 comments on commit d2e3e49

Please sign in to comment.