fix base64 test

pull/2159/head
Alexander Medvednikov 2019-09-28 22:21:48 +03:00
parent 9eac16b976
commit ed93185cb7
2 changed files with 20 additions and 20 deletions

View File

@ -607,7 +607,7 @@ fn (p mut Parser) struct_decl() {
p.error('type names cannot contain `_`') p.error('type names cannot contain `_`')
} }
if !p.builtin_mod && !name[0].is_capital() { if !p.builtin_mod && !name[0].is_capital() {
p.error('struct names must be capitalized: `struct Foo {`, not `struct foo {`') p.error('struct names must be capitalized: use `struct ${name.capitalize()}`')
} }
if is_interface && !name.ends_with('er') { if is_interface && !name.ends_with('er') {
p.error('interface names temporarily have to end with `er` (e.g. `Speaker`, `Reader`)') p.error('interface names temporarily have to end with `er` (e.g. `Speaker`, `Reader`)')

View File

@ -1,6 +1,6 @@
import encoding.base64 import encoding.base64
struct testpair { struct TestPair {
decoded string decoded string
encoded string encoded string
} }
@ -8,28 +8,28 @@ struct testpair {
const ( const (
pairs = [ pairs = [
// RFC 3548 examples // RFC 3548 examples
testpair{'\x14\xfb\x9c\x03\xd9\x7e', 'FPucA9l+'}, TestPair{'\x14\xfb\x9c\x03\xd9\x7e', 'FPucA9l+'},
testpair{'\x14\xfb\x9c\x03\xd9', 'FPucA9k='}, TestPair{'\x14\xfb\x9c\x03\xd9', 'FPucA9k='},
testpair{'\x14\xfb\x9c\x03', 'FPucAw=='}, TestPair{'\x14\xfb\x9c\x03', 'FPucAw=='},
// RFC 4648 examples // RFC 4648 examples
testpair{'', ''}, TestPair{'', ''},
testpair{'f', 'Zg=='}, TestPair{'f', 'Zg=='},
testpair{'fo', 'Zm8='}, TestPair{'fo', 'Zm8='},
testpair{'foo', 'Zm9v'}, TestPair{'foo', 'Zm9v'},
testpair{'foob', 'Zm9vYg=='}, TestPair{'foob', 'Zm9vYg=='},
testpair{'fooba', 'Zm9vYmE='}, TestPair{'fooba', 'Zm9vYmE='},
testpair{'foobar', 'Zm9vYmFy'}, TestPair{'foobar', 'Zm9vYmFy'},
// Wikipedia examples // Wikipedia examples
testpair{'sure.', 'c3VyZS4='}, TestPair{'sure.', 'c3VyZS4='},
testpair{'sure', 'c3VyZQ=='}, TestPair{'sure', 'c3VyZQ=='},
testpair{'sur', 'c3Vy'}, TestPair{'sur', 'c3Vy'},
testpair{'su', 'c3U='}, TestPair{'su', 'c3U='},
testpair{'leasure.', 'bGVhc3VyZS4='}, TestPair{'leasure.', 'bGVhc3VyZS4='},
testpair{'easure.', 'ZWFzdXJlLg=='}, TestPair{'easure.', 'ZWFzdXJlLg=='},
testpair{'asure.', 'YXN1cmUu'}, TestPair{'asure.', 'YXN1cmUu'},
testpair{'sure.', 'c3VyZS4='}, TestPair{'sure.', 'c3VyZS4='},
] ]
) )