Merge pull request #126 from NickyBoy89/master

This commit is contained in:
Tnze
2021-11-02 09:18:18 +08:00
committed by GitHub
3 changed files with 2089 additions and 3 deletions

2085
nbt/1-dimension_codec.snbt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -115,9 +115,6 @@ func stateBeginValue(s *scanner, c byte) int {
return s.pushParseState(c, parseListValue, scanBeginList) return s.pushParseState(c, parseListValue, scanBeginList)
case '"', '\'': // beginning of TAG_String case '"', '\'': // beginning of TAG_String
return stateBeginString(s, c) return stateBeginString(s, c)
case '-': // beginning of negative number
s.step = stateNeg
return scanBeginLiteral
default: default:
if isNumber(c) { if isNumber(c) {
stateNum0(s, c) stateNum0(s, c)

View File

@ -43,12 +43,16 @@ func TestSNBT_number(t *testing.T) {
//go:embed bigTest_test.snbt //go:embed bigTest_test.snbt
var bigTestSNBT string var bigTestSNBT string
//go:embed 1-dimension_codec.snbt
var dimensionCodecSNBT string
func TestSNBT_compound(t *testing.T) { func TestSNBT_compound(t *testing.T) {
goods := []string{ goods := []string{
`{}`, `{name:3.14f}`, `{ "name" : 12345 }`, `{}`, `{name:3.14f}`, `{ "name" : 12345 }`,
`{ abc: { }}`, `{ "a b\"c": {}, def: 12345}`, `{ abc: { }}`, `{ "a b\"c": {}, def: 12345}`,
`{ ghi: [], klm: 1}`, `{ ghi: [], klm: 1}`,
bigTestSNBT, bigTestSNBT,
dimensionCodecSNBT,
} }
var s scanner var s scanner
for _, str := range goods { for _, str := range goods {