aboutsummaryrefslogtreecommitdiffstats
path: root/errs/errors_test.go
blob: d6d14b45eaad6abc6067406390676eb0a56069dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

package errs

import (
    "fmt"
    "testing"

    "github.com/ethereum/go-ethereum/logger"
)

func testErrors() *Errors {
    return &Errors{
        Package: "TEST",
        Errors: map[int]string{
            0: "zero",
            1: "one",
        },
        Level: func(i int) (l logger.LogLevel) {
            if i == 0 {
                l = logger.ErrorLevel
            } else {
                l = logger.WarnLevel
            }
            return
        },
    }
}

func TestErrorMessage(t *testing.T) {
    err := testErrors().New(0, "zero detail %v", "available")
    message := fmt.Sprintf("%v", err)
    exp := "[TEST] ERROR: zero: zero detail available"
    if message != exp {
        t.Errorf("error message incorrect. expected %v, got %v", exp, message)
    }
}

func TestErrorSeverity(t *testing.T) {
    err0 := testErrors().New(0, "zero detail")
    if !err0.Fatal() {
        t.Errorf("error should be fatal")
    }
    err1 := testErrors().New(1, "one detail")
    if err1.Fatal() {
        t.Errorf("error should not be fatal")
    }
}
tw44/cgit/freebsd-ports-gnome/commit/emulators?id=528cecc4e059f2e8052ba15c64b45e8ce7d87054'>Deploy USE_GNOMENG infrastructurelioux2002-08-306-12/+17 * Correct "script failed" installation error introduced in the last commit.trevor2002-08-301-4/+7 * Update XFree86 libraries to 3.3.6-29, to avoid multiple securitytrevor2002-08-304-11/+5 * Remove old glibc hashes.trevor2002-08-301-2/+0 * Update glibc to 2.1.3-26 to avoid resolver and RPC security bugs.trevor2002-08-305-138/+353 * Update to version 0.8.22kevlo2002-08-302-3/+2 * Bump PORTREVISION for the glibc update.trevor2002-08-286-6/+6 * Update glibc to 2.2.4-29, to avoid resolver and RPC security bugs.trevor2002-08-2830-1164/+3390 * These should have the resolver bug too.trevor2002-08-267-7/+7 * Forbid because of XDR security bug.trevor2002-08-267-0/+14 * Turn Miguel Mendez' ports over to Adam Weinberger.trevor2002-08-265-8/+3 * Fix vmware2 for -current so that it compiles again.joe2002-08-154-0/+26 * Current doesn't use KMODDEPS.joe2002-08-141-0/+2 * Fix startup-scripts for -current /bin/sh issues.anders2002-08-148-8/+16 * Fix missing dependency, take maintainershipdinoex2002-08-101-2/+5 * Add patch to fix build because some paths need correction, alreadypat2002-08-081-0/+28 * Update to the 2002.08.04 version of Wine. (This also removesgerald2002-08-0512-84/+62 * Fix links to the Handbook, the FAQ and the porters-handbook.blackend2002-08-042-2/+2 * Chase shlib rev of devel/gettextade2002-08-021-1/+1 * Update to 20020111nakai2002-07-303-42/+33 * Add file/site hints.nsayer2002-07-281-3/+3 * Use MASTER_SITE_REDHAT_LINUX.knu2002-07-261-15/+4 * Use MASTER_SITE_REDHAT_LINUX.knu2002-07-266-72/+24 * Add grustibus 0.43, an xmame frontend for Gnome.petef2002-07-257-0/+68 * Update to 1.2.3pat2002-07-132-5/+6 * Update to 1.4.1pat2002-07-133-33/+20 * Update the Wine port to version 2002.07.10.gerald2002-07-118-28/+26 * Use my FreeBSD.org mail address for the MAINTAINER field.gerald2002-07-102-2/+2 * Sanitize MASTER_SITESlioux2002-07-082-4/+2 * o Sanitize MASTER_SITESlioux2002-07-082-3/+2 * Bump XForms lib. version.mikeh2002-07-041-1/+1 * Prepare for xforms update.mikeh2002-07-041-1/+3 * Merge Mark Daniel Szlaga's tape patches into the port, Fix some PORTDOCS issues.ijliao2002-06-2512-601/+501 * Update to 1.35 and bump PORTEPOCHpat2002-06-254-56/+6 * Update to version 6.4.jkoshy2002-06-212-5/+4 * add cinc 2.1.3ijliao2002-06-206-0/+36 * - Add patch which fixes build under certain configurationspat2002-06-193-1/+42 * - Get rid of PERL and use SEDdinoex2002-06-162-2/+4 * update master_sitesijliao2002-06-141-1/+1 * don't include malloc.halfred2002-06-132-0/+20 * MASTER_SITES been fixed so take out hardcoding of FETCH_CMD.pat2002-06-121-3/+0 * Miguel Mendez informed me in private e-mail that he has changed his mindwill2002-06-113-3/+3 * Handle lib/wine/glu32.dll.so and lib/wine/glu32.dll.so, whose existencegerald2002-06-112-0/+4 * Update to 1.0.4.sobomax2002-06-104-5/+31 * - GNU_CONFIGURE -> USE_LIBTOOLijliao2002-06-092-10/+13 * - GNU_CONFIGURE -> USE_LIBTOOLijliao2002-06-092-7/+7 * To ports@freebsd.org.obrien2002-06-091-1/+1 * Prefer generic nasm instead of nasm-0.98 as BUILD_DEPENDS inlioux2002-06-081-1/+1 * In MASTER_SITES, follow redirect so fetch does not have to.trevor2002-06-071-1/+1 * Set Miguel Mendez' ports loose. Look out, world!trevor2002-06-073-3/+3 * Update to the 2002.06.05 version of Wine. Once again, lots of files havegerald2002-06-078-58/+116 * add vx68k 1.1.10ijliao2002-06-046-0/+54 * add libvm68k 1.0.6ijliao2002-06-046-0/+48 * These bits are now known as linux_base.obrien2002-05-2810-19245/+0 * Remove linux_base-7. That is now the default version.obrien2002-05-281-1/+0 * Upgrade to Red Hat 7.x support. Many binary-only packages are now requiringobrien2002-05-2830-13722/+63444 * This file isn't used any more -- distinfo.{ARCH} is.obrien2002-05-286-330/+0 * Turn on linux_base-6.obrien2002-05-281-1/+1 * Add hercules-2.15kris2002-05-259-0/+683 * Add a couple of missing entries for $PREFIX/bin to pkg-plist.gerald2002-05-242-0/+44 * Greatly simplify the post-patch: target, now that Wine does not setgerald2002-05-242-2/+2 * Move the s/\r// from post-configure to pre-patch to makejedgar2002-05-232-2/+2 * Add patch to allow building on bento.jedgar2002-05-222-0/+22 * Take into account that Wine now requires a configuration file in the homegerald2002-05-224-10/+20 * BROKEN: Does not buildkris2002-05-181-0/+2 * Catch up checksums of arch-neutral files to distinfo.i386kris2002-05-166-24/+24 * Add vmware-tools2 and vmware-tools3 and remove vmware-toolskris2002-05-151-1/+2 * Update to 1.4pat2002-05-153-8/+10 * Update to 0.2.0pat2002-05-155-30/+58 * Update to 0.60.1pat2002-05-144-6/+27 * Additional documentation actually resides in $PREFIX/share/doc/wine, notgerald2002-05-142-4/+4 * Update to the 2002.05.09 snapshot of Wine.gerald2002-05-136-20/+10 * Patches to gdb-5.2 from the gdb CVS repository. These are needed tomp2002-05-132-0/+240 * Update to gdb-5.2 release.mp2002-05-132-11/+4 * This port is divided into ports/emulators/vmware-tools{2,3}matusita2002-05-114-109/+0 * Mark FORBIDDEN if PACKAGE_BUILDING. These ports cannot build withoutmatusita2002-05-119-0/+27 * Update VMware toolbox and VMware guestd to 3.1.1 build 1790.matusita2002-05-1118-27/+27 * After repocopying from ports/emulators/vmware-tools, this directorymatusita2002-05-116-76/+26 * To ports@freebsd.org.obrien2002-05-091-1/+1 * To ia64@freebsd.org.obrien2002-05-091-1/+1 * Update port to 2.9.9 (woohoo, versioned distfiles again!)jedgar2002-05-084-6/+6 * Unbreak zsnes with the latest SDL update: disable joystick code for nowdwcjr2002-05-081-0/+35 * o Update checksum for redhat-release. It has been repackaged. Nomarcel2002-05-051-2/+2 * Do not --disable-opengl any longer, which mostly was used to work aroundgerald2002-04-302-2/+0 * add missing directory.nork2002-04-2912-0/+12 * Enable threading, enable the GUI.anders2002-04-211-1/+9 * Say goodbye to Qt 1.x and all of its dependents. The one port I foundwill2002-04-1911-99/+0 * Chase increase of libSDL version number.sobomax2002-04-177-7/+7 * Update port to V2.9-5 (2.9.5).jedgar2002-04-174-4/+4 * Fix entries for slave portspat2002-04-171-2/+5 * gettext upgrade uber-patch (stage 3)ade2002-04-131-1/+2 * Update to the 2002-04-09 snapshot of what will be version 5.2.obrien2002-04-132-2/+2 * Update to the 2002.04.11 snapshot of Wine. Lots of libraries ingerald2002-04-126-252/+288 * Update port to 2.9.4.jedgar2002-04-124-4/+4 * - Update to 4.1pat2002-04-082-2/+6 * Update to the 2002-04-02 snapshot of what will be version 5.2.obrien2002-04-043-19/+7 * I thought our Red Hat Linux emulation was at 6.2, not 6.1.obrien2002-04-0311-11010/+0 * Update port to version V2.9-3 (2.9.3)jedgar2002-04-024-4/+4 * We can safely assume that vmware-guestd is already installed whilematusita2002-03-316-36/+6 * Use installed vmware-guestd to detach VMware Tools CD-ROM.matusita2002-03-315-30/+5 * A Adam Computer / ColecoVision Emulatordinoex2002-03-307-0/+74 * Update to 0.59.1pat2002-03-272-8/+5 * Add new port games/scummvm - A free implementation of LucasArts S.C.U.M.M.pat2002-03-276-0/+89 * Update to the 2002-03-25 snapshot of what will be version 5.2.obrien2002-03-263-2/+14 * Add USE_SUBMAKE, where it might be necessary.sobomax2002-03-253-0/+3 * Update to version 0.58.3kevlo2002-03-235-91/+121 * Stage 1 of gettext update.ade2002-03-161-1/+1 * Update to the 2002-03-15 snapshot of what will be version 5.2.obrien2002-03-162-8/+5 * Change my email address to the one of @FreeBSD.org.matusita2002-03-1516-16/+16 * Bump PORTREVISION for the zlib update.trevor2002-03-138-0/+8 * Update for zlib "double free" security bugtrevor2002-03-1248-64/+80 * Correct checksum for Alpha zlib package.trevor2002-03-121-1/+1 * Update to zlib-1.1.3-25.7. This fixes the "double free" bug. Seetrevor2002-03-123-6/+6 * Unbroke on recent -current: we now need <arpa/inet.h> to get proto forsobomax2002-03-121-0/+13 * Update to 2002.03.10pat2002-03-128-18/+22 * Add patch to fix package buildpat2002-03-121-0/+13 * Update to the 2002-03-10 snapshot of what will be version 5.2.obrien2002-03-114-25/+15 * Update to 0.8.21pat2002-03-092-2/+2 * Update port. DISTFILE name did not change but includes the followingjedgar2002-03-046-28/+34 * Update to 4.0pat2002-03-034-48/+22 * Update to version 5.1.1.obrien2002-03-032-2/+2 * Disconnect linux_base-62 from the build since it hasn't been updatedknu2002-02-181-1/+1 * Update to 0.58.1pat2002-02-083-2/+12 * Release MAINTAINER.nectar2002-02-071-1/+1 * Change some defines from "YES" to "yes"dinoex2002-01-281-1/+1 * Update port to 2.9.jedgar2002-01-288-102/+470 * Back out the recently added kludge. Instead, install thetrevor2002-01-253-7/+14 * On i386, add a symlink to linux_base-7 so the stdc++ shared librarytrevor2002-01-242-0/+8 * update to 2002.01.22.sf2002-01-248-156/+162 * Add mtab to packing lists.trevor2002-01-232-0/+2 * fix this totally broken port.sf2002-01-233-19/+14 * Update to 0.8.20pat2002-01-222-4/+3 * Oops. Add missing entry to plistpat2002-01-111-0/+1 * Fix plistpat2002-01-111-2/+2 * Upgrade to 0.57.1.sumikawa2002-01-102-3/+21 * - Update to 3.0.0pat2002-01-093-16/+7 * Upgrade to version 1.3. Bochs works now wonderfullmbr2002-01-093-4/+8 * include pre.mk for XFREE86_VERSION usage.sf2002-01-071-1/+3 * Remove obsolete patch files.olgeni2002-01-072-60/+0 * Mail to the maintainer bounces.will2002-01-071-1/+1 * If XFREE86_VERSION=4, we need mkfontdir from x11/XFree86-4-clients.will2002-01-071-0/+6 * - make portlint happierdinoex2002-01-061-4/+5 * Update port to version 0.56.2 (plus new cheat.zip MD5 and German docs)olgeni2002-01-055-27/+35 * Update to 1.2.2pat2002-01-056-82/+29 * - PORTVERSION 0.4.3 => 0.4.4.ijliao2002-01-024-4/+44 * Use '::' as an dependency operator for pre-everything target. This isdirk2001-12-311-1/+1 * Update to version 2001-12-16.demon2001-12-288-32/+16 * portlint:dirk2001-12-261-1/+1 * Add missing linux_base-62 SUBDIR.will2001-12-241-0/+1 * - PORTDOCS policepat2001-12-242-10/+10 * Fix ownership on ${LINUXBASE}/var/spool/mail.petef2001-12-238-0/+8 * o update to 1.4.2.sf2001-12-236-62/+117 * - Fix build of xmess (broken due to differences in patches w/ xmame masterijliao2001-12-133-0/+61 * upgrade to 1.0.3ijliao2001-12-102-2/+2 * Unbreak this port on 5.x by removing include of sys/user.halfred2001-12-082-0/+24 * Fix Makefilekevlo2001-12-061-2/+2 * Fix -current breakage caused by a type change of pt_entry_t.marcel2001-12-064-0/+28 * Update to latest release (gdb-5.1).mp2001-12-052-3/+3 * bump PORTREVISION to reflect addition to pkg-plist.sf2001-12-052-0/+2 * add missing file to PLISTijliao2001-12-052-0/+2 * Update to the latest patchfile.jmz2001-12-023-3/+6 * Update to 0.8.18dwcjr2001-11-243-20/+37 * upgrade to 1.7ijliao2001-11-245-27/+74 * Update port to version 0.56.1.olgeni2001-11-224-17/+49 * Additional MASTER_SITE to handle Temporary move of the distfilelioux2001-11-192-2/+4 * Pass maintainership over to ports@FreeBSD.org. The linux_base portsmarcel2001-11-189-9/+9 * Update to version 2001.11.08.steve2001-11-1610-94/+34 * Change Vladimir's email address.marcel2001-11-112-2/+2 * Update for VMware 3.0.0 build 1455.matusita2001-11-1136-192/+486 * Add vmware-guestd, a daemon for VMware 3.x FreeBSD guest OS.matusita2001-11-1129-0/+690 * Apply the KSE patch on post-KSE systems. This unbreaks the portmarcel2001-11-112-0/+6 * Patch to make this compile on post-KSE systems.marcel2001-11-112-0/+1162 * Set LATEST_LINK to `linux_base-7'.knu2001-11-071-0/+1 * - update to 0.4.1epetef2001-11-053-11/+12 * Update to latest snapshot (gdb-5.0.92).mp2001-11-032-6/+3 * Update to version 1.337.olgeni2001-10-294-37/+20 * Update MASTER_SITES (minnie.cs.adfa.oz.au -> minnie.tuhs.org)jedgar2001-10-292-2/+2 * Make sure there's a mtab in etc. This is required in a couple ofmarcel2001-10-211-1/+4 * Update to version 1.2.1kevlo2001-10-205-73/+219