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

     1  package cmdconfig_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	_ "github.com/lmorg/murex/builtins"
     7  	"github.com/lmorg/murex/test"
     8  )
     9  
    10  func TestConfigCLI(t *testing.T) {
    11  	tests := []test.MurexTest{
    12  		{
    13  			Block: `
    14  				config: define config test {
    15  					"Description": "This is only a test",
    16  					"DataType": "bool",
    17  					"Global": true,
    18  					"Default": false
    19  				}
    20  
    21  				config: get config test
    22  				
    23  				config: set config test true
    24  
    25  				config: get config test
    26  				`,
    27  			Stdout: "false\ntrue\n",
    28  		},
    29  		{
    30  			Block: `
    31  				config: define config test {
    32  					"Description": "This is only a test",
    33  					"DataType": "bool",
    34  					"Global": false,
    35  					"Default": false
    36  				}
    37  
    38  				config: get config test
    39  				
    40  				config: set config test true
    41  
    42  				config: get config test
    43  				`,
    44  			Stdout: "false\ntrue\n",
    45  		},
    46  		{
    47  			Block: `
    48  				config: define config test {
    49  					"Description": "This is only a test",
    50  					"DataType": "bool",
    51  					"Global": true,
    52  					"Default": false
    53  				}
    54  
    55  				config: get config test
    56  				
    57  				function TestConfigCLI {
    58  					config: get config test
    59  
    60  					config: set config test true
    61  
    62  					config: get config test
    63  				}
    64  
    65  				config: get config test
    66  				TestConfigCLI
    67  				config: get config test
    68  				`,
    69  			Stdout: "false\nfalse\nfalse\ntrue\ntrue\n",
    70  		},
    71  		{
    72  			Block: `
    73  				config: define config test {
    74  					"Description": "This is only a test",
    75  					"DataType": "bool",
    76  					"Global": false,
    77  					"Default": false
    78  				}
    79  
    80  				config: get config test
    81  				
    82  				function TestConfigCLI {
    83  					config: get config test
    84  
    85  					config: set config test true
    86  
    87  					config: get config test
    88  				}
    89  
    90  				config: get config test
    91  				TestConfigCLI
    92  				config: get config test
    93  				`,
    94  			Stdout: "false\nfalse\nfalse\ntrue\nfalse\n",
    95  		},
    96  		{
    97  			Block: `
    98  				config: define config test {
    99  					"Description": "This is only a test",
   100  					"DataType": "bool",
   101  					"Global": false,
   102  					"Default": false
   103  				}
   104  
   105  				config: get config test
   106  				
   107  				private TestConfigCLI {
   108  					config: get config test
   109  
   110  					config: set config test true
   111  
   112  					config: get config test
   113  				}
   114  
   115  				config: get config test
   116  				TestConfigCLI
   117  				config: get config test
   118  				`,
   119  			Stdout: "false\nfalse\nfalse\ntrue\nfalse\n",
   120  		},
   121  	}
   122  
   123  	test.RunMurexTests(tests, t)
   124  }