blob: 2f99c70c56b31e46055c66f798d22876bdd0e6e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
discard """
action: reject
nimout: '''tusages.nim(22, 5) Error: 'BAD_STYLE' should be: 'BADSTYLE' [proc declared in tusages.nim(11, 6)]'''
matrix: "--styleCheck:error --styleCheck:usages"
"""
import strutils
proc BADSTYLE(c: char) = discard
proc toSnakeCase(s: string): string =
result = newStringOfCap(s.len + 3)
for i in 0..<s.len:
if s[i] in {'A'..'Z'}:
if i > 0 and s[i-1] in {'a'..'z'}:
result.add '_'
result.add toLowerAscii(s[i])
else:
result.add s[i]
BAD_STYLE(s[i])
echo toSnakeCase("fooBarBaz Yes")
|