Commit 288e16a7 authored by Kirill Smelkov's avatar Kirill Smelkov

errors: Test for New (C++)

errors.New was added in a245ab56 (errors: New package) without test.
parent c7c07828
...@@ -10,6 +10,7 @@ include golang/context.cpp ...@@ -10,6 +10,7 @@ include golang/context.cpp
include golang/cxx.h include golang/cxx.h
include golang/errors.h include golang/errors.h
include golang/errors.cpp include golang/errors.cpp
include golang/errors_test.cpp
include golang/fmt.h include golang/fmt.h
include golang/fmt.cpp include golang/fmt.cpp
include golang/fmt_test.cpp include golang/fmt_test.cpp
......
/_context.cpp /_context.cpp
/_errors_test.cpp
/_fmt_test.cpp /_fmt_test.cpp
/_golang.cpp /_golang.cpp
/_golang_test.cpp /_golang_test.cpp
......
# -*- coding: utf-8 -*-
# cython: language_level=2
# distutils: language=c++
#
# Copyright (C) 2020 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
from golang cimport topyexc
# errors_test.cpp
cdef extern from * nogil:
"""
extern void _test_errors_new_cpp();
"""
void _test_errors_new_cpp() except +topyexc
def test_errors_new_cpp():
with nogil:
_test_errors_new_cpp()
// Copyright (C) 2020 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
#include "golang/errors.h"
#include "golang/_testing.h"
using namespace golang;
void _test_errors_new_cpp() {
error err = errors::New("hello world");
ASSERT_EQ(err->Error(), "hello world");
}
# -*- coding: utf-8 -*-
# Copyright (C) 2020 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
from __future__ import print_function, absolute_import
from golang.golang_test import import_pyx_tests
import_pyx_tests("golang._errors_test")
...@@ -251,6 +251,10 @@ setup( ...@@ -251,6 +251,10 @@ setup(
Ext('golang._context', Ext('golang._context',
['golang/_context.pyx']), ['golang/_context.pyx']),
Ext('golang._errors_test',
['golang/_errors_test.pyx',
'golang/errors_test.cpp']),
Ext('golang._fmt_test', Ext('golang._fmt_test',
['golang/_fmt_test.pyx', ['golang/_fmt_test.pyx',
'golang/fmt_test.cpp']), 'golang/fmt_test.cpp']),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment