waveterm/pkg/waveobj/waveobj_test.go

31 lines
606 B
Go
Raw Normal View History

2024-05-26 02:37:05 +02:00
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
package waveobj
import (
"log"
"reflect"
"testing"
)
2024-05-26 20:59:14 +02:00
type TestBlock struct {
BlockId string `json:"blockid" waveobj:"oid"`
Name string `json:"name"`
}
func (TestBlock) GetOType() string {
return "block"
}
2024-05-26 02:37:05 +02:00
func TestGenerate(t *testing.T) {
log.Printf("Testing Generate\n")
tsMap := make(map[reflect.Type]string)
var waveObj WaveObj
GenerateTSType(reflect.TypeOf(&waveObj).Elem(), tsMap)
2024-05-26 20:59:14 +02:00
GenerateTSType(reflect.TypeOf(TestBlock{}), tsMap)
2024-05-26 02:37:05 +02:00
for k, v := range tsMap {
log.Printf("Type: %v, TS:\n%s\n", k, v)
}
}