Permalink
Browse files

Only eval rands to defaultsTo if needed

  • Loading branch information...
1 parent 85815b9 commit e070cb39f53e0b083ef4556654e283ebc83b72ad @windley windley committed Jul 12, 2016
Showing with 7 additions and 1 deletion.
  1. +1 −1 Kynetx/Operators.pm
  2. +6 −0 t/Request.t
View
@@ -2234,9 +2234,9 @@ sub eval_defaults_to {
my ($expr, $rule_env, $rule_name, $req_info, $session) = @_;
my $logger = get_logger();
my $obj = Kynetx::Expressions::eval_expr($expr->{'obj'}, $rule_env, $rule_name,$req_info, $session);
- my $rands = Kynetx::Expressions::eval_rands($expr->{'args'}, $rule_env, $rule_name,$req_info, $session);
my $new_val = $obj;
if (_is_null($obj)) {
+ my $rands = Kynetx::Expressions::eval_rands($expr->{'args'}, $rule_env, $rule_name,$req_info, $session);
$new_val = $rands->[0];
if (defined $rands->[1] ) { # optional log message
my $msg = Kynetx::Expressions::den_to_exp($rands->[1]);
View
@@ -182,6 +182,12 @@ Kynetx::Request::add_event_attr($my_req_info, "type", "tope");
is(Kynetx::Request::get_attr($my_req_info, "type"), undef, $description);
$test_count++;
+$description = "Add an attribute";
+Kynetx::Request::add_event_attr($my_req_info, "name", "flop");
+is(Kynetx::Request::get_attr($my_req_info, "name"), "flop", $description);
+$test_count++;
+
+
######################### Clean up
Kynetx::Test::flush_test_user($user_ken,$user_username);

0 comments on commit e070cb3

Please sign in to comment.