Not sure if this belongs here or golang-dev, but...

I'm copying the unicode/utf8 and unicode/utf16 tests for my own C library that 
also deals with UTF-8 and UTF-16 (because why not), and there's one thing I'm 
confused about in the former:

https://github.com/golang/go/blob/d2951740303587fc0c5d14cb5461e39b099e6695/src/unicode/utf8/utf8_test.go#L143-L152
// there's an extra byte that bytes left behind - make sure trailing byte works
r, size = DecodeRune(b[0:cap(b)])
if r != m.r || size != len(b) {
    t.Errorf("DecodeRune(%q) = %#04x, %d want %#04x, %d", b, r, size, m.r, 
len(b))
}
s = m.str + "\x00"
r, size = DecodeRuneInString(s)
if r != m.r || size != len(b) {
    t.Errorf("DecodeRuneInString(%q) = %#04x, %d want %#04x, %d", s, r, size, 
m.r, len(b))
}

What is this supposed to be doing? I tried going through the git history to 
find any context and the only thing I can figure is that there are lots of 
leftovers from super early Go (in fact, this whole test suite is full of 
them...). In particular, shouldn't the first line there not be different from 
just the test on b?

Or is there something more subtle?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to