(t *testing.T)
| 506 | } |
| 507 | |
| 508 | func TestQuoteUnquote(t *testing.T) { |
| 509 | tests := []struct { |
| 510 | name string |
| 511 | testStr string |
| 512 | expectedErr string |
| 513 | expectedOutput string |
| 514 | expectedRuntimeCost uint64 |
| 515 | expectedEstimatedCost checker.CostEstimate |
| 516 | disableQuote bool |
| 517 | disableCELEval bool |
| 518 | }{ |
| 519 | { |
| 520 | name: "remove quotes only", |
| 521 | testStr: "this is a test", |
| 522 | expectedEstimatedCost: checker.FixedCostEstimate(2), |
| 523 | expectedRuntimeCost: 2, |
| 524 | }, |
| 525 | { |
| 526 | name: "mid-string newline", |
| 527 | testStr: "first\nsecond", |
| 528 | expectedEstimatedCost: checker.FixedCostEstimate(2), |
| 529 | expectedRuntimeCost: 2, |
| 530 | }, |
| 531 | { |
| 532 | name: "bell", |
| 533 | testStr: "bell\a", |
| 534 | expectedEstimatedCost: checker.FixedCostEstimate(1), |
| 535 | expectedRuntimeCost: 1, |
| 536 | }, |
| 537 | { |
| 538 | name: "backspace", |
| 539 | testStr: "\bbackspace", |
| 540 | expectedEstimatedCost: checker.FixedCostEstimate(1), |
| 541 | expectedRuntimeCost: 1, |
| 542 | }, |
| 543 | { |
| 544 | name: "form feed", |
| 545 | testStr: "\fform feed", |
| 546 | expectedEstimatedCost: checker.FixedCostEstimate(1), |
| 547 | expectedRuntimeCost: 1, |
| 548 | }, |
| 549 | { |
| 550 | name: "carriage return", |
| 551 | testStr: "carriage \r return", |
| 552 | expectedEstimatedCost: checker.FixedCostEstimate(2), |
| 553 | expectedRuntimeCost: 2, |
| 554 | }, |
| 555 | { |
| 556 | name: "horizontal tab", |
| 557 | testStr: "horizontal \ttab", |
| 558 | expectedEstimatedCost: checker.FixedCostEstimate(2), |
| 559 | expectedRuntimeCost: 2, |
| 560 | }, |
| 561 | { |
| 562 | name: "vertical tab", |
| 563 | testStr: "vertical \v tab", |
| 564 | expectedEstimatedCost: checker.FixedCostEstimate(2), |
| 565 | expectedRuntimeCost: 2, |
nothing calls this directly
no test coverage detected