github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/pipe/namedpipe_test.go (about)

     1  package cmdpipe_test
     2  
     3  import (
     4  	"fmt"
     5  	"sync/atomic"
     6  	"testing"
     7  
     8  	_ "github.com/lmorg/murex/builtins"
     9  	"github.com/lmorg/murex/test"
    10  )
    11  
    12  func TestReadPipe(t *testing.T) {
    13  	id := atomic.AddInt32(&uniqueID, 1)
    14  
    15  	tests := []test.MurexTest{{
    16  		Block: fmt.Sprintf(`
    17  			function murex_test_readpipe_%d {
    18  				echo <null> this is a dummy line
    19  				if { true } then {
    20  					<stdin> -> match 2
    21  				}
    22  			}
    23  
    24  			out 1 -> murex_test_readpipe_%d
    25  			out 2 -> murex_test_readpipe_%d
    26  			out 3 -> murex_test_readpipe_%d
    27  		`, id, id, id, id),
    28  		ExitNum: 0,
    29  		Stdout:  "2\n",
    30  		Stderr:  ``,
    31  	}}
    32  
    33  	test.RunMurexTests(tests, t)
    34  }