Skip to content

Commit

Permalink
patch v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
metalwolf committed Feb 28, 2022
1 parent a34aa51 commit bf75543
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For GO, the actual existing code includes:

Manuals are available on godoc.org [![GoDoc](https://godoc.org/github.com/webability-go/xcore/v2?status.png)](https://godoc.org/github.com/webability-go/xcore/v2)

The version 1 is obsolete.
# The version 1 is obsolete.


Version Changes Control
Expand Down
8 changes: 8 additions & 0 deletions v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
XCore for GO v2
=============================

Minimum version of GO: 1.17 (for time.Time compatibility)

The XCore package is used to build basic object for programmation. for the WebAbility compatility code
For GO, the actual existing code includes:
- XCache: Application Memory Caches, thread safe.
Expand All @@ -31,6 +33,12 @@ Some improvements to check, later:
Version Changes Control
=======================

v2.1.0 - 2022-02-27
-----------------------
- XLanguage: bug corrected on unlock of stringload and loadFromFile (was blocking the system)
- XTemplate: The metalanguage keywords are now only recognized if they match authorized characters (for instance &&keyword&&), to avoid bugs in JS with && and || and !!.
- Print functions of time.Time corrected (as in go 1.17, the print format changes) into the *test.go test functions

v2.0.9 - 2021-11-25
-----------------------
- XCache modified to defer mutex unlocks instead of directly unlock into the code, to avoid dead locks in case of thread panic and crashes.
Expand Down
2 changes: 1 addition & 1 deletion v2/xcore.go
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@
package xcore

// VERSION is the used version nombre of the XCore library.
const VERSION = "2.0.9"
const VERSION = "2.1.0"

// LOG is the flag to activate logging on the library.
// if LOG is set to TRUE, LOG indicates to the XCore libraries to log a trace of functions called, with most important parameters.
Expand Down
6 changes: 3 additions & 3 deletions v2/xdataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestXDataset_new(t *testing.T) {

ds := NewXDataset(data)
str := fmt.Sprintf("%#v", ds)
if str != "#xcore.XDataset{clientname:\"Fred\" clientpicture:\"face.jpg\" hobbies:XDatasetCollection[0:xcore.XDataset{name:Football sport:yes} 1:xcore.XDataset{name:Ping-pong sport:yes} 2:xcore.XDataset{name:Swimming sport:yes} 3:xcore.XDataset{name:Videogames sport:no} ] metadata:#xcore.XDataset{Salary:3568.65 hiredate:time.Time{wall:0x0, ext:63713476800, loc:(*time.Location)(nil)} preferred-color:\"blue\"} preferredhobby:#xcore.XDataset{name:\"Baseball\" sport:\"yes\"}}" {
if str != "#xcore.XDataset{clientname:\"Fred\" clientpicture:\"face.jpg\" hobbies:XDatasetCollection[0:xcore.XDataset{name:Football sport:yes} 1:xcore.XDataset{name:Ping-pong sport:yes} 2:xcore.XDataset{name:Swimming sport:yes} 3:xcore.XDataset{name:Videogames sport:no} ] metadata:#xcore.XDataset{Salary:3568.65 hiredate:time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC) preferred-color:\"blue\"} preferredhobby:#xcore.XDataset{name:\"Baseball\" sport:\"yes\"}}" {
t.Error("Error creating and #printing new complex XDataset " + str)
return
}
Expand All @@ -96,7 +96,7 @@ func TestXDataset_simple_print(t *testing.T) {
}

str = fmt.Sprintf("%#v", ds)
if str != "#xcore.XDataset{v1:123 v2:\"abc\" v3:true vpi:3.1415927 vt:time.Time{wall:0x0, ext:63713476800, loc:(*time.Location)(nil)}}" {
if str != "#xcore.XDataset{v1:123 v2:\"abc\" v3:true vpi:3.1415927 vt:time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC)}" {
t.Error("Error creating and #printing simple XDataset " + str)
return
}
Expand Down Expand Up @@ -145,7 +145,7 @@ func TestXDataset_complex_print(t *testing.T) {
}

str = fmt.Sprintf("%#v", data)
if str != "#xcore.XDataset{clientname:\"Fred\" clientpicture:\"face.jpg\" hobbies:XDatasetCollection[0:xcore.XDataset{name:Football sport:yes} 1:xcore.XDataset{name:Ping-pong sport:yes} 2:xcore.XDataset{name:Swimming sport:yes} 3:xcore.XDataset{name:Videogames sport:no} ] metadata:#xcore.XDataset{hascat:true hasdog:false hiredate:time.Time{wall:0x0, ext:63713476800, loc:(*time.Location)(nil)} numdata1:0 numdata2:17 preferred-color:\"blue\" previoussalary:0 resume:\"\" salary:3568.65} preferredhobby:#xcore.XDataset{name:\"Baseball\" sport:\"yes\"}}" {
if str != "#xcore.XDataset{clientname:\"Fred\" clientpicture:\"face.jpg\" hobbies:XDatasetCollection[0:xcore.XDataset{name:Football sport:yes} 1:xcore.XDataset{name:Ping-pong sport:yes} 2:xcore.XDataset{name:Swimming sport:yes} 3:xcore.XDataset{name:Videogames sport:no} ] metadata:#xcore.XDataset{hascat:true hasdog:false hiredate:time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC) numdata1:0 numdata2:17 preferred-color:\"blue\" previoussalary:0 resume:\"\" salary:3568.65} preferredhobby:#xcore.XDataset{name:\"Baseball\" sport:\"yes\"}}" {
t.Error("Error creating and #printing complex XDataset " + str)
return
}
Expand Down
2 changes: 1 addition & 1 deletion v2/xdatasetcollectionts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestXDatasetCollectionTS_simple_print(t *testing.T) {
}

str = fmt.Sprintf("%#v", ds)
if str != "#xcore.XDataset{v1:123 v2:\"abc\" v3:true vpi:3.1415927 vt:time.Time{wall:0x0, ext:63713476800, loc:(*time.Location)(nil)}}" {
if str != "#xcore.XDataset{v1:123 v2:\"abc\" v3:true vpi:3.1415927 vt:time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC)}" {
t.Error("Error creating and #printing simple XDataset " + str)
return
}
Expand Down
4 changes: 2 additions & 2 deletions v2/xdatasetts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestXDatasetTS_simple_print(t *testing.T) {
}

str = fmt.Sprintf("%#v", ds)
if str != "#xcore.XDataset{v1:123 v2:\"abc\" v3:true vpi:3.1415927 vt:time.Time{wall:0x0, ext:63713476800, loc:(*time.Location)(nil)}}" {
if str != "#xcore.XDataset{v1:123 v2:\"abc\" v3:true vpi:3.1415927 vt:time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC)}" {
t.Error("Error creating and #printing simple XDataset " + str)
return
}
Expand Down Expand Up @@ -117,7 +117,7 @@ func TestXDatasetTS_complex_print(t *testing.T) {
}

str = fmt.Sprintf("%#v", data)
if str != "#xcore.XDataset{clientname:\"Fred\" clientpicture:\"face.jpg\" hobbies:XDatasetCollection[0:xcore.XDataset{name:Football sport:yes} 1:xcore.XDataset{name:Ping-pong sport:yes} 2:xcore.XDataset{name:Swimming sport:yes} 3:xcore.XDataset{name:Videogames sport:no} ] metadata:#xcore.XDataset{hascat:true hasdog:false hiredate:time.Time{wall:0x0, ext:63713476800, loc:(*time.Location)(nil)} numdata1:0 numdata2:17 preferred-color:\"blue\" previoussalary:0 resume:\"\" salary:3568.65} preferredhobby:#xcore.XDataset{name:\"Baseball\" sport:\"yes\"}}" {
if str != "#xcore.XDataset{clientname:\"Fred\" clientpicture:\"face.jpg\" hobbies:XDatasetCollection[0:xcore.XDataset{name:Football sport:yes} 1:xcore.XDataset{name:Ping-pong sport:yes} 2:xcore.XDataset{name:Swimming sport:yes} 3:xcore.XDataset{name:Videogames sport:no} ] metadata:#xcore.XDataset{hascat:true hasdog:false hiredate:time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC) numdata1:0 numdata2:17 preferred-color:\"blue\" previoussalary:0 resume:\"\" salary:3568.65} preferredhobby:#xcore.XDataset{name:\"Baseball\" sport:\"yes\"}}" {
t.Error("Error creating and #printing complex XDataset " + str)
return
}
Expand Down
2 changes: 1 addition & 1 deletion v2/xlanguage.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func (l *XLanguage) LoadString(data string) error {
value = strings.TrimSpace(line[posequal+1:])
}
l.mutex.Lock()
defer l.mutex.Unlock()
l.entries[key] = value
l.mutex.Unlock()
}
if err := scanner.Err(); err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions v2/xlanguage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ func TestXLanguage(t *testing.T) {
return
}

return

// from xml string
xmlstr, err := ioutil.ReadFile("./testunit/errors.es.xml")
if err != nil {
Expand Down
12 changes: 6 additions & 6 deletions v2/xtemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ func (t *XTemplate) compile(data string) error {
`(%)--(.*?)--%(\n|\r|\r\n|\n\r)?` + // index based 1

// ==== LANGUAGE INJECTION
`|(#)#(.+?)##` + // index based 4
`|(#)#([a-zA-Z0-9-_\.]+?)##` + // index based 4

// ==== ELEMENTS
`|(&)&(.+?)&&` + // index based 6
`|(@)@(.+?)@@` + // index based 8
`|(\?)\?(.+?)\?\?` + // index based 10
`|(\!)\!(.+?)\!\!` + // index based 12
`|(\{)\{(.+?)\}\}` + // index based 14
`|(&)&([a-zA-Z0-9-_\:\|\.]+?)&&` + // index based 6
`|(@)@([a-zA-Z0-9-_\:\|\.]+?)@@` + // index based 8
`|(\?)\?([a-zA-Z0-9-_\:\|\.]+?)\?\?` + // index based 10
`|(\!)\!([a-zA-Z0-9-_\:\|\.]+?)\!\!` + // index based 12
`|(\{)\{([a-zA-Z0-9-_\:\|\.]+?)\}\}` + // index based 14

// ==== NESTED ELEMENTS (SUB TEMPLATES)
`|\[\[(\])\](\n|\r|\r\n|\n\r)?` + // index based 16
Expand Down

0 comments on commit bf75543

Please sign in to comment.