@@ -61,6 +61,21 @@ func Test_framer(t *testing.T) {
6161 t .Run ("null" , func (t * testing.T ) {
6262 runTest (t , "null" , nil )
6363 })
64+
65+ // Test raw string values (without JSON encoding) - this reproduces the user issue
66+ t .Run ("raw string values" , func (t * testing.T ) {
67+ runRawTest (t , "raw-string" , []byte ("on" ), []byte ("off" ), []byte ("admin_off" ))
68+ })
69+
70+ // Test raw numeric values
71+ t .Run ("raw numeric values" , func (t * testing.T ) {
72+ runRawTest (t , "raw-number" , []byte ("123" ), []byte ("456.789" ))
73+ })
74+
75+ // Test mixed raw values
76+ t .Run ("mixed raw values" , func (t * testing.T ) {
77+ runRawTest (t , "raw-mixed" , []byte ("25" ), []byte ("on" ), []byte ("123.45" ))
78+ })
6479}
6580
6681func runTest (t * testing.T , name string , values ... any ) {
@@ -77,6 +92,20 @@ func runTest(t *testing.T, name string, values ...any) {
7792 experimental .CheckGoldenJSONFrame (t , "testdata" , name , frame , update )
7893}
7994
95+ func runRawTest (t * testing.T , name string , rawValues ... []byte ) {
96+ t .Helper ()
97+ f := newFramer ()
98+ timestamp := time .Unix (0 , 0 )
99+ messages := []Message {}
100+ for i , v := range rawValues {
101+ messages = append (messages , Message {Timestamp : timestamp .Add (time .Duration (i ) * time .Minute ), Value : v })
102+ }
103+ frame , err := f .toFrame (messages )
104+ require .NoError (t , err )
105+ require .NotNil (t , frame )
106+ experimental .CheckGoldenJSONFrame (t , "testdata" , name , frame , update )
107+ }
108+
80109func toJSON (v interface {}) []byte {
81110 b , err := json .Marshal (v )
82111 if err != nil {
0 commit comments