Skip to content

Commit

Permalink
added time() builtin
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Jan 22, 2013
1 parent 4aa7386 commit 64b9159
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ruby/ycp/builtins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,10 @@ def self.size object
raise "Invalid object for size() builtin"
end
end

# time() YCP built-in
def self.time
Time.now.to_i
end
end
end
4 changes: 4 additions & 0 deletions tests/ruby/builtins_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,8 @@ def test_size
assert_equal 2, YCP::Builtins.size(YCP::Term.new(:HBox, "test", "test"))
assert_equal 1, YCP::Builtins.size(YCP::Term.new(:HBox, YCP::Term.new(:VBox, "test", "test")))
end

def test_time
assert YCP::Builtins.time > 0
end
end

0 comments on commit 64b9159

Please sign in to comment.