File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -276,8 +276,9 @@ func nimIdentNormalize*(s: string): string =
276276 runnableExamples:
277277 doAssert nimIdentNormalize (" Foo_bar" ) == " Foobar"
278278 result = newString (s.len)
279- if s.len > 0 :
280- result [0 ] = s[0 ]
279+ if s.len == 0 :
280+ return
281+ result [0 ] = s[0 ]
281282 var j = 1
282283 for i in 1 .. len (s) - 1 :
283284 if s[i] in {'A' .. 'Z' }:
Original file line number Diff line number Diff line change 841841 doAssert s.endsWith ('a' ) == false
842842 doAssert s.endsWith ('\0 ' ) == false
843843
844+ block : # nimIdentNormalize
845+ doAssert nimIdentNormalize (" " ) == " "
846+ doAssert nimIdentNormalize (" foo" ) == " foo"
847+ doAssert nimIdentNormalize (" foo_bar" ) == " foobar"
848+ doAssert nimIdentNormalize (" Foo_bar" ) == " Foobar"
849+ doAssert nimIdentNormalize (" _Foo_bar" ) == " _foobar"
850+
844851static : main ()
845852main ()
You can’t perform that action at this time.
0 commit comments