q/src/ssa/Bytes_test.go
Eduard Urbach 1fa27dca51
All checks were successful
/ test (push) Successful in 17s
Added SSA tests
2025-06-30 13:34:15 +02:00

23 lines
No EOL
594 B
Go

package ssa_test
import (
"testing"
"git.urbach.dev/cli/q/src/ssa"
"git.urbach.dev/cli/q/src/types"
"git.urbach.dev/go/assert"
)
func TestBytes(t *testing.T) {
fn := ssa.IR{}
hello := fn.Append(&ssa.Bytes{Bytes: []byte("Hello")})
world := fn.Append(&ssa.Bytes{Bytes: []byte("World")})
helloDup := fn.Append(&ssa.Bytes{Bytes: []byte("Hello")})
one := fn.AppendInt(1)
assert.False(t, hello.Equals(world))
assert.False(t, hello.Equals(one))
assert.True(t, hello.Equals(helloDup))
assert.Equal(t, hello.String(), "\"Hello\"")
assert.True(t, types.Is(hello.Type(), types.String))
}