This repository has been archived by the owner on Dec 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLF-102 Remove generator, NewClassM, module id in xyerror
- Loading branch information
1 parent
9d70b23
commit 159bb44
Showing
13 changed files
with
197 additions
and
258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
# Developing | ||
|
||
- Make it simple by removing Generator. | ||
|
||
# v0.0.1 (Sep 02, 2022) | ||
|
||
- Migrated from the [origin project](https://github.com/xybor/xyplatform). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,16 @@ | ||
package xyerror_test | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/xybor-x/xycond" | ||
"github.com/xybor-x/xyerror" | ||
) | ||
|
||
func TestClassNewClass(t *testing.T) { | ||
var id = nextid() | ||
var egen = xyerror.Register("gen", id) | ||
var c1 = egen.NewClass("class1") | ||
var c1 = xyerror.NewClass("class1") | ||
var c2 = c1.NewClass("class2") | ||
xycond.ExpectEqual(c1.Error(), classmsg(id+1, "class1")).Test(t) | ||
xycond.ExpectEqual(c2.Error(), classmsg(id+2, "class2")).Test(t) | ||
} | ||
|
||
func TestClassNewClassM(t *testing.T) { | ||
var id1 = nextid() | ||
var id2 = nextid() | ||
var egen1 = xyerror.Register("gen", id1) | ||
var egen2 = xyerror.Register("gen", id2) | ||
var c1 = egen1.NewClass("class") | ||
var c2 = c1.NewClassM(egen2) | ||
xycond.ExpectEqual(c2.Error(), classmsg(id2+1, "class")).Test(t) | ||
xycond.ExpectTrue(strings.Contains(c1.Error(), "class1")).Test(t) | ||
xycond.ExpectTrue(strings.Contains(c2.Error(), "class2")).Test(t) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
package xyerror | ||
|
||
// Default is the default error generator. | ||
var Default = Register("default", 100000) | ||
|
||
// Default predefined errors. | ||
var ( | ||
Error = Default.NewClass("Error") | ||
IOError = Default.NewClass("IOError") | ||
FloatingPointError = Default.NewClass("FloatingPointError") | ||
IndexError = Default.NewClass("IndexError") | ||
KeyError = Default.NewClass("KeyError") | ||
NotImplementedError = Default.NewClass("NotImplementedError") | ||
ValueError = Default.NewClass("ValueError") | ||
ParameterError = Default.NewClass("ParameterError") | ||
TypeError = Default.NewClass("TypeError") | ||
AssertionError = Default.NewClass("AssertionError") | ||
Error = NewClass("Error") | ||
IOError = NewClass("IOError") | ||
FloatingPointError = NewClass("FloatingPointError") | ||
IndexError = NewClass("IndexError") | ||
KeyError = NewClass("KeyError") | ||
NotImplementedError = NewClass("NotImplementedError") | ||
ValueError = NewClass("ValueError") | ||
ParameterError = NewClass("ParameterError") | ||
TypeError = NewClass("TypeError") | ||
AssertionError = NewClass("AssertionError") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.