diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..5c13e0e --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,36 @@ +name: CI + +on: + pull_request: + branches: + - main + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + main: + runs-on: ubuntu-latest + strategy: + matrix: + ruby: + - "3.1" + - "3.2" + - "3.3" + - "3.4" + - ruby-head + name: "Ruby ${{ matrix.ruby }}: ${{ matrix.task }}" + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "${{ matrix.ruby }}" + bundler-cache: true + # install castxml for the importer tests + - run: sudo apt-get update && sudo apt-get install -y castxml + - run: bundle install + - run: bundle exec rake spec diff --git a/.gitignore b/.gitignore index 24f1319..6b621f4 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,6 @@ Gemfile.lock # rspec failure tracking .rspec_status -.rspec # apple files .DS_Store diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..34c5164 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/lib/ctypes/struct.rb b/lib/ctypes/struct.rb index 6db3a86..511f70c 100644 --- a/lib/ctypes/struct.rb +++ b/lib/ctypes/struct.rb @@ -517,6 +517,7 @@ def pretty_print(q) # :nodoc: type.is_a?(CTypes::Pad) end q.seplist(fields, -> { q.breakable("") }) do |name, _| + names = name.is_a?(::Array) ? name : [name] names.each do |name| next if name.is_a?(CTypes::Pad) q.text(".#{name} = ")