github.com/DataDog/datadog-agent/pkg/security/secl@v0.55.0-devel.0.20240517055856-10c4965fea94/model/strings_test.go (about)

     1  // Unless explicitly stated otherwise all files in this repository are licensed
     2  // under the Apache License Version 2.0.
     3  // This product includes software developed at Datadog (https://www.datadoghq.com/).
     4  // Copyright 2016-present Datadog, Inc.
     5  
     6  // Package model holds model related files
     7  package model
     8  
     9  import (
    10  	"testing"
    11  
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  func TestIsPrintable(t *testing.T) {
    16  	assert.Equal(t, true, IsPrintable("A-B"))
    17  	assert.Equal(t, true, IsPrintable("A/B"))
    18  	assert.Equal(t, false, IsPrintable("\n"))
    19  	assert.Equal(t, false, IsPrintable("\u001d"))
    20  }
    21  
    22  func TestIsPrintableASCII(t *testing.T) {
    23  	assert.Equal(t, true, IsPrintableASCII("A-B"))
    24  	assert.Equal(t, true, IsPrintableASCII("A/B"))
    25  	assert.Equal(t, true, IsPrintableASCII("/dev/pts2"))
    26  	assert.Equal(t, false, IsPrintableASCII("\n"))
    27  	assert.Equal(t, false, IsPrintableASCII("\u001d"))
    28  }