add testcase for #9165 (#15787)

This commit is contained in:
flywind 2020-10-30 16:57:02 +08:00 • committed by GitHub
commit 1655c04aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

11
tests/converter/t9165.nim Normal file
View file

@ -0,0 +1,11 @@
type ustring = distinct string
converter toUString(s: string): ustring = ustring(s)
converter toString(s: ustring): string = string(s)
proc `[]=`*(s: var ustring, slice: Slice[int], replacement: ustring) {.inline.} =
s = replacement
var s = ustring("123")
s[1..2] = "3"
doAssert s == "3"