github.com/gotranspile/cxgo@v0.3.8-0.20240118201721-29871598a6a2/libs/stdarg_test.go (about)

     1  package libs
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/gotranspile/cxgo/types"
     9  )
    10  
    11  var expStdArgsH = `#ifndef _cxgo_STDARG_H
    12  #define _cxgo_STDARG_H
    13  #include <cxgo_builtin.h>
    14  
    15  #define va_list __builtin_va_list
    16  #define va_start(va, t) va.Start(t, _rest)
    17  #define va_arg(va, typ) (typ)(va.Arg())
    18  #define va_end(va) va.End()
    19  #define va_copy(dst, src) __builtin_va_copy(dst, src)
    20  
    21  
    22  #endif // _cxgo_STDARG_H
    23  `
    24  
    25  func TestStdargH(t *testing.T) {
    26  	c := NewEnv(types.Config32())
    27  	l, ok := c.GetLibrary(StdargH)
    28  	require.True(t, ok)
    29  	require.Equal(t, expStdArgsH, l.Header)
    30  }