summaryrefslogtreecommitdiff
path: root/crypt_test.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-12-07 00:26:53 +0800
committerxuri <xuri.me@gmail.com>2021-12-07 00:26:53 +0800
commit44a13aa402b0189b119635d2f0a26961795c6bda (patch)
tree0000ed94fe92507517281812ba49d85aa58a7211 /crypt_test.go
parent3325c3946d0ab77083555bab334381a1167ee580 (diff)
Export 7 errors so users can act differently on different type of errors
Diffstat (limited to 'crypt_test.go')
-rw-r--r--crypt_test.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypt_test.go b/crypt_test.go
index cb0b160..0796482 100644
--- a/crypt_test.go
+++ b/crypt_test.go
@@ -21,16 +21,16 @@ import (
func TestEncrypt(t *testing.T) {
f, err := OpenFile(filepath.Join("test", "encryptSHA1.xlsx"), Options{Password: "password"})
assert.NoError(t, err)
- assert.EqualError(t, f.SaveAs(filepath.Join("test", "BadEncrypt.xlsx"), Options{Password: "password"}), "not support encryption currently")
+ assert.EqualError(t, f.SaveAs(filepath.Join("test", "BadEncrypt.xlsx"), Options{Password: "password"}), ErrEncrypt.Error())
assert.NoError(t, f.Close())
}
func TestEncryptionMechanism(t *testing.T) {
mechanism, err := encryptionMechanism([]byte{3, 0, 3, 0})
assert.Equal(t, mechanism, "extensible")
- assert.EqualError(t, err, "unsupport encryption mechanism")
+ assert.EqualError(t, err, ErrUnsupportEncryptMechanism.Error())
_, err = encryptionMechanism([]byte{})
- assert.EqualError(t, err, "unknown encryption mechanism")
+ assert.EqualError(t, err, ErrUnknownEncryptMechanism.Error())
}
func TestHashing(t *testing.T) {