cuelang.org/go@v0.13.0/tools/trim/testdata/defaults.txtar (about)

     1  -- in.cue --
     2  domToSub: {
     3  	foo: [string]: a: *1 | int
     4  	foo: b: a:        1
     5  }
     6  
     7  // Issue #759
     8  subToDom: {
     9  	#maybeString: {ip?: string}
    10  	something: ip: *"default" | string
    11  	something: #maybeString
    12  }
    13  
    14  // references to definitions of a disjunction should be resolved and counted
    15  // as dominator nodes.
    16  resolveDefaults: {
    17  	#monitor: {
    18  		kind: "a"
    19  	} | {
    20  		kind: "b"
    21  	}
    22  
    23  	monitor: #monitor
    24  
    25  	monitor: kind: "a"
    26  }
    27  
    28  issue781: {
    29  	#monitor_check: {
    30  		check_name:      string
    31  		check_interval?: string
    32  	}
    33  
    34  	#monitor_check: {
    35  		check_type: "nginx_config"
    36  	} | {
    37  		check_type: "docker_running"
    38  		vars: {
    39  			container_name: string
    40  		}
    41  	}
    42  
    43  	monitor: {
    44  		checks: [...#monitor_check]
    45  	}
    46  
    47  	monitor: {
    48  		checks: [{
    49  			check_type: "nginx_config"
    50  			check_name: "nginx_config"
    51  		}]
    52  	}
    53  }
    54  
    55  // Issue #801
    56  // Here the concrete value selects the default from a dominator, after which
    57  // the dominator becomes an exact match. The exact match should not allow it
    58  // to be erased, as the exact match is only there because subordinate value
    59  // was first used to select the default.
    60  dontEraseDefaultSelection: {
    61  	rule: _#Rule & {
    62  		verbs: ["c"]
    63  	}
    64  	_#Rule: {
    65  		verbs: *["a", "b"] | ["c"]
    66  	}
    67  }
    68  -- out/trim-v3 --
    69  == in.cue
    70  domToSub: {
    71  	foo: [string]: a: *1 | int
    72  	foo: b: _
    73  }
    74  
    75  // Issue #759
    76  subToDom: {
    77  	#maybeString: {ip?: string}
    78  	something: ip: *"default" | string
    79  	something: #maybeString
    80  }
    81  
    82  // references to definitions of a disjunction should be resolved and counted
    83  // as dominator nodes.
    84  resolveDefaults: {
    85  	#monitor: {
    86  		kind: "a"
    87  	} | {
    88  		kind: "b"
    89  	}
    90  
    91  	monitor: #monitor
    92  
    93  	monitor: kind: "a"
    94  }
    95  
    96  issue781: {
    97  	#monitor_check: {
    98  		check_name:      string
    99  		check_interval?: string
   100  	}
   101  
   102  	#monitor_check: {
   103  		check_type: "nginx_config"
   104  	} | {
   105  		check_type: "docker_running"
   106  		vars: {
   107  			container_name: string
   108  		}
   109  	}
   110  
   111  	monitor: {
   112  		checks: [...#monitor_check]
   113  	}
   114  
   115  	monitor: {
   116  		checks: [{
   117  			check_type: "nginx_config"
   118  			check_name: "nginx_config"
   119  		}]
   120  	}
   121  }
   122  
   123  // Issue #801
   124  // Here the concrete value selects the default from a dominator, after which
   125  // the dominator becomes an exact match. The exact match should not allow it
   126  // to be erased, as the exact match is only there because subordinate value
   127  // was first used to select the default.
   128  dontEraseDefaultSelection: {
   129  	rule: _#Rule & {
   130  		verbs: ["c"]
   131  	}
   132  	_#Rule: {
   133  		verbs: *["a", "b"] | ["c"]
   134  	}
   135  }
   136  -- diff/-out/trim-v3<==>+out/trim --
   137  diff old new
   138  --- old
   139  +++ new
   140  @@ -1,7 +1,7 @@
   141   == in.cue
   142   domToSub: {
   143   	foo: [string]: a: *1 | int
   144  -	foo: b: {}
   145  +	foo: b: _
   146   }
   147   
   148   // Issue #759
   149  -- out/trim-v3-noshare --
   150  == in.cue
   151  domToSub: {
   152  	foo: [string]: a: *1 | int
   153  	foo: b: _
   154  }
   155  
   156  // Issue #759
   157  subToDom: {
   158  	#maybeString: {ip?: string}
   159  	something: ip: *"default" | string
   160  	something: #maybeString
   161  }
   162  
   163  // references to definitions of a disjunction should be resolved and counted
   164  // as dominator nodes.
   165  resolveDefaults: {
   166  	#monitor: {
   167  		kind: "a"
   168  	} | {
   169  		kind: "b"
   170  	}
   171  
   172  	monitor: #monitor
   173  
   174  	monitor: kind: "a"
   175  }
   176  
   177  issue781: {
   178  	#monitor_check: {
   179  		check_name:      string
   180  		check_interval?: string
   181  	}
   182  
   183  	#monitor_check: {
   184  		check_type: "nginx_config"
   185  	} | {
   186  		check_type: "docker_running"
   187  		vars: {
   188  			container_name: string
   189  		}
   190  	}
   191  
   192  	monitor: {
   193  		checks: [...#monitor_check]
   194  	}
   195  
   196  	monitor: {
   197  		checks: [{
   198  			check_type: "nginx_config"
   199  			check_name: "nginx_config"
   200  		}]
   201  	}
   202  }
   203  
   204  // Issue #801
   205  // Here the concrete value selects the default from a dominator, after which
   206  // the dominator becomes an exact match. The exact match should not allow it
   207  // to be erased, as the exact match is only there because subordinate value
   208  // was first used to select the default.
   209  dontEraseDefaultSelection: {
   210  	rule: _#Rule & {
   211  		verbs: ["c"]
   212  	}
   213  	_#Rule: {
   214  		verbs: *["a", "b"] | ["c"]
   215  	}
   216  }
   217  -- diff/-out/trim-v3-noshare<==>+out/trim --
   218  diff old new
   219  --- old
   220  +++ new
   221  @@ -1,7 +1,7 @@
   222   == in.cue
   223   domToSub: {
   224   	foo: [string]: a: *1 | int
   225  -	foo: b: {}
   226  +	foo: b: _
   227   }
   228   
   229   // Issue #759
   230  -- out/trim --
   231  == in.cue
   232  domToSub: {
   233  	foo: [string]: a: *1 | int
   234  	foo: b: {}
   235  }
   236  
   237  // Issue #759
   238  subToDom: {
   239  	#maybeString: {ip?: string}
   240  	something: ip: *"default" | string
   241  	something: #maybeString
   242  }
   243  
   244  // references to definitions of a disjunction should be resolved and counted
   245  // as dominator nodes.
   246  resolveDefaults: {
   247  	#monitor: {
   248  		kind: "a"
   249  	} | {
   250  		kind: "b"
   251  	}
   252  
   253  	monitor: #monitor
   254  
   255  	monitor: kind: "a"
   256  }
   257  
   258  issue781: {
   259  	#monitor_check: {
   260  		check_name:      string
   261  		check_interval?: string
   262  	}
   263  
   264  	#monitor_check: {
   265  		check_type: "nginx_config"
   266  	} | {
   267  		check_type: "docker_running"
   268  		vars: {
   269  			container_name: string
   270  		}
   271  	}
   272  
   273  	monitor: {
   274  		checks: [...#monitor_check]
   275  	}
   276  
   277  	monitor: {
   278  		checks: [{
   279  			check_type: "nginx_config"
   280  			check_name: "nginx_config"
   281  		}]
   282  	}
   283  }
   284  
   285  // Issue #801
   286  // Here the concrete value selects the default from a dominator, after which
   287  // the dominator becomes an exact match. The exact match should not allow it
   288  // to be erased, as the exact match is only there because subordinate value
   289  // was first used to select the default.
   290  dontEraseDefaultSelection: {
   291  	rule: _#Rule & {
   292  		verbs: ["c"]
   293  	}
   294  	_#Rule: {
   295  		verbs: *["a", "b"] | ["c"]
   296  	}
   297  }