Skip to content

Commit

Permalink
add support for unicode 13.0.0
Browse files Browse the repository at this point in the history
Go 1.16 supports Unicode 13. Update testdata accordingly.
Add test generation script, set max version in build
constraint, and update CI.
  • Loading branch information
smasher164 committed Feb 17, 2021
1 parent 6ce40ef commit 560c18f
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
go-version: [1.14.x, 1.15.x, 1.16.x]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
!go.mod
!go.sum
!*.md
!*.go
!*.go
!*.py
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/smasher164/xid

go 1.15
go 1.14

require golang.org/x/text v0.3.3
20 changes: 20 additions & 0 deletions testdata/gendata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This script generates testdata for particular version of unicode.
# Used Python 3.8.7 && regex==2020.2.20 to generate cases for unicode 12.1.0.
# Used Python 3.9.1 && regex>2020.2.20 to generate cases for unicode 13.0.0.

import unicodedata
import regex
import sys
import gzip

def gendata(category):
f = gzip.open(f'{category}{unicodedata.unidata_version}.txt.gz', 'wb')
for r in range(sys.maxunicode+1):
matched = bool(regex.match(f'\p{{{category}}}', chr(r)))
if matched:
f.write(b'T')
else:
f.write(b'F')

gendata('xid_start')
gendata('xid_continue')
Binary file added testdata/xid_continue13.0.0.txt.gz
Binary file not shown.
Binary file added testdata/xid_start13.0.0.txt.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion unicodeTestVersion_114.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// +build go1.14
// +build go1.14,!go1.16

package xid

Expand Down
5 changes: 5 additions & 0 deletions unicodeTestVersion_116.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// +build go1.16

package xid

const unicodeTestVersion = "13.0.0"

0 comments on commit 560c18f

Please sign in to comment.