Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

test/ruby/test_syntax.rb: tests for keyword not

* test/ruby/test_syntax.rb (TestSyntax#test_keyword_not): tests for
  keyword not.
  • Loading branch information...
commit eb8b6973df01618ca9b1881e6b94e947eb8b32fd 1 parent dfdf256
Nobuyoshi Nakada authored

Showing 2 changed files with 16 additions and 0 deletions. Show diff stats Hide diff stats

  1. +7 0 test/ruby/envutil.rb
  2. +9 0 test/ruby/test_syntax.rb
7 test/ruby/envutil.rb
@@ -190,6 +190,13 @@ def assert_warning(*args)
190 190 assert_warn(*args) {$VERBOSE = false; yield}
191 191 end
192 192
  193 + def assert_quiet(*args)
  194 + stderr = EnvUtil.verbose_warning { yield }
  195 + message = ' "' + message + '"' if message
  196 + msg = proc {"warning message #{stderr.inspect} is not expected#{message}"}
  197 + assert(stderr.empty?, msg)
  198 + end
  199 +
193 200 def assert_no_memory_leak(args, prepare, code, message=nil, limit: 1.5)
194 201 token = "\e[7;1m#{$$.to_s}:#{Time.now.strftime('%s.%L')}:#{rand(0x10000).to_s(16)}:\e[m"
195 202 token_dump = token.dump
9 test/ruby/test_syntax.rb
@@ -181,6 +181,15 @@ def test_reserved_method_no_args
181 181 assert_valid_syntax("def self; :foo; end", __FILE__, bug6403)
182 182 end
183 183
  184 + def test_keyword_not
  185 + assert_quiet do
  186 + ['false || not(true)', 'not(true)', 'not (true)', 'not[]', 'not []'].each do |code|
  187 + assert_valid_syntax(code, __FILE__, verbose: true)
  188 + assert_valid_syntax("p(#{code})", __FILE__, verbose: true)
  189 + end
  190 + end
  191 + end
  192 +
184 193 private
185 194
186 195 def not_label(x) @result = x; @not_label ||= nil end

0 comments on commit eb8b697

Please sign in to comment.
Something went wrong with that request. Please try again.